未验证 提交 a3535812 编写于 作者: Z Zeng Jinle 提交者: GitHub

add _use_system_allocator to some op tests, test=develop (#21504)

上级 18a5d307
...@@ -19,11 +19,13 @@ import numpy as np ...@@ -19,11 +19,13 @@ import numpy as np
import paddle.fluid.core as core import paddle.fluid.core as core
from paddle.fluid.op import Operator from paddle.fluid.op import Operator
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid.tests.unittests.op_test import OpTest from paddle.fluid.tests.unittests.op_test import OpTest, _set_use_system_allocator
from paddle.fluid.framework import grad_var_name from paddle.fluid.framework import grad_var_name
from paddle.fluid.tests.unittests.test_batch_norm_op import TestBatchNormOpInference, TestBatchNormOpTraining, _reference_training, _reference_grad from paddle.fluid.tests.unittests.test_batch_norm_op import TestBatchNormOpInference, TestBatchNormOpTraining, _reference_training, _reference_grad
from mkldnn_op_test import check_if_mkldnn_batchnorm_primitives_exist_in_bwd from mkldnn_op_test import check_if_mkldnn_batchnorm_primitives_exist_in_bwd
_set_use_system_allocator(True)
class TestMKLDNNBatchNormOpTraining(TestBatchNormOpTraining): class TestMKLDNNBatchNormOpTraining(TestBatchNormOpTraining):
def init_kernel_type(self): def init_kernel_type(self):
......
...@@ -16,6 +16,9 @@ from __future__ import print_function ...@@ -16,6 +16,9 @@ from __future__ import print_function
import unittest import unittest
from paddle.fluid.tests.unittests.test_batch_norm_op import TestBatchNormOpTraining, TestBatchNormOpInference from paddle.fluid.tests.unittests.test_batch_norm_op import TestBatchNormOpTraining, TestBatchNormOpInference
from paddle.fluid.tests.unittests.op_test import _set_use_system_allocator
_set_use_system_allocator(True)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
...@@ -20,11 +20,13 @@ import numpy as np ...@@ -20,11 +20,13 @@ import numpy as np
import paddle.fluid.core as core import paddle.fluid.core as core
from paddle.fluid.op import Operator from paddle.fluid.op import Operator
import paddle.fluid as fluid import paddle.fluid as fluid
from op_test import OpTest from op_test import OpTest, _set_use_system_allocator
from paddle.fluid.framework import grad_var_name from paddle.fluid.framework import grad_var_name
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid import Program, program_guard from paddle.fluid import Program, program_guard
_set_use_system_allocator(True)
def _reference_testing(x, scale, offset, mean, var, epsilon, data_format): def _reference_testing(x, scale, offset, mean, var, epsilon, data_format):
x_shape = x.shape x_shape = x.shape
......
...@@ -20,9 +20,12 @@ from operator import mul ...@@ -20,9 +20,12 @@ from operator import mul
import paddle.fluid.core as core import paddle.fluid.core as core
import paddle.fluid as fluid import paddle.fluid as fluid
from functools import reduce from functools import reduce
from op_test import _set_use_system_allocator
np.random.random(123) np.random.random(123)
_set_use_system_allocator(True)
def _reference_layer_norm_naive(x, scale, beta, epsilon, begin_norm_axis=1): def _reference_layer_norm_naive(x, scale, beta, epsilon, begin_norm_axis=1):
x_shape = x.shape x_shape = x.shape
......
...@@ -26,7 +26,9 @@ import paddle.fluid.core as core ...@@ -26,7 +26,9 @@ import paddle.fluid.core as core
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid import compiler from paddle.fluid import compiler
from op_test import OpTest from op_test import OpTest, _set_use_system_allocator
_set_use_system_allocator(True)
def create_or_get_tensor(scope, var_name, var, place): def create_or_get_tensor(scope, var_name, var, place):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册