[Dy2stat] Add GPU unittest of test_se_resnet (#24582)

* test_seresnet support gpu test=develop

* Set the Flag by core.globals test=develop

* modify into set_flags test=develop
v1.8
Aurelius84 6 years ago committed by GitHub
parent 483955b0c2
commit 85ff797494
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,7 +16,6 @@ import logging
import math
import time
import unittest
import numpy as np
import paddle
@ -34,9 +33,14 @@ EPOCH_NUM = 1
PRINT_STEP = 2
STEP_NUM = 10
place = fluid.CPUPlace()
# TODO(liym27): Diff exists between dygraph and static graph on CUDA place.
# place = fluid.CUDAPlace(0) if fluid.is_compiled_with_cuda() else fluid.CPUPlace()
place = fluid.CUDAPlace(0) if fluid.is_compiled_with_cuda() \
else fluid.CPUPlace()
# Note: Set True to eliminate randomness.
# 1. For one operation, cuDNN has several algorithms,
# some algorithm results are non-deterministic, like convolution algorithms.
if fluid.is_compiled_with_cuda():
fluid.set_flags({'FLAGS_cudnn_deterministic': True})
train_parameters = {
"learning_strategy": {

Loading…
Cancel
Save