diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_batch_norm_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_batch_norm_mkldnn_op.py index eb12470789ab9a6e416e829832986a11cd576474..2c8daf38175bf450fd547cc7069f3025702cb947 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_batch_norm_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_batch_norm_mkldnn_op.py @@ -19,11 +19,13 @@ import numpy as np import paddle.fluid.core as core from paddle.fluid.op import Operator 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.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 +_set_use_system_allocator(True) + class TestMKLDNNBatchNormOpTraining(TestBatchNormOpTraining): def init_kernel_type(self): diff --git a/python/paddle/fluid/tests/unittests/ngraph/test_batch_norm_ngraph_op.py b/python/paddle/fluid/tests/unittests/ngraph/test_batch_norm_ngraph_op.py index 34fb73f3cf7e8b3d906ed4e04d151923aa219ab1..d9198114f3c4bf9a5de19b4d0121267bcfe3f0f2 100644 --- a/python/paddle/fluid/tests/unittests/ngraph/test_batch_norm_ngraph_op.py +++ b/python/paddle/fluid/tests/unittests/ngraph/test_batch_norm_ngraph_op.py @@ -16,6 +16,9 @@ from __future__ import print_function import unittest 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__': unittest.main() diff --git a/python/paddle/fluid/tests/unittests/test_batch_norm_op.py b/python/paddle/fluid/tests/unittests/test_batch_norm_op.py index 851dfe39e48ea16699b3baa5ad39cc33c32dfb03..7c445594c708cda315a0ba45030a922d6e92569e 100644 --- a/python/paddle/fluid/tests/unittests/test_batch_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_batch_norm_op.py @@ -20,11 +20,13 @@ import numpy as np import paddle.fluid.core as core from paddle.fluid.op import Operator 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 import paddle.fluid as fluid from paddle.fluid import Program, program_guard +_set_use_system_allocator(True) + def _reference_testing(x, scale, offset, mean, var, epsilon, data_format): x_shape = x.shape diff --git a/python/paddle/fluid/tests/unittests/test_layer_norm_op.py b/python/paddle/fluid/tests/unittests/test_layer_norm_op.py index d5724b6e3ca59c288d2f23bc5591f267ab235d1f..4bd7a98cb924a45ff60f4908627c386b20d9cbde 100644 --- a/python/paddle/fluid/tests/unittests/test_layer_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_layer_norm_op.py @@ -20,9 +20,12 @@ from operator import mul import paddle.fluid.core as core import paddle.fluid as fluid from functools import reduce +from op_test import _set_use_system_allocator np.random.random(123) +_set_use_system_allocator(True) + def _reference_layer_norm_naive(x, scale, beta, epsilon, begin_norm_axis=1): x_shape = x.shape diff --git a/python/paddle/fluid/tests/unittests/test_sync_batch_norm_op.py b/python/paddle/fluid/tests/unittests/test_sync_batch_norm_op.py index a9eccf4a2106d3225c59364a9dee4311e33ce221..8fd118c0193035fce294aa6ac23951d57ba43f78 100644 --- a/python/paddle/fluid/tests/unittests/test_sync_batch_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_sync_batch_norm_op.py @@ -26,7 +26,9 @@ import paddle.fluid.core as core import paddle.fluid as fluid 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):