diff --git a/.gitignore b/.gitignore index 4b53cfd8591686efc8c92a169620e75620ddbac1..4ddcff8adc7d589edca16b507c760187464e431d 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,7 @@ model_test Testing tools/__pycache__ +tools/nvcc_lazy # This file is automatically generated. # TODO(zhiqiang) Move this file to build directory. diff --git a/python/paddle/fluid/tests/unittests/ir/inference/test_conv_elementwise_add2_act_fuse_pass.py b/python/paddle/fluid/tests/unittests/ir/inference/test_conv_elementwise_add2_act_fuse_pass.py index 90848f58a544a6c7c2e4823f18d2e5a7481b6596..2279db872c64d8c594f772a7b4b9f081aa99b555 100755 --- a/python/paddle/fluid/tests/unittests/ir/inference/test_conv_elementwise_add2_act_fuse_pass.py +++ b/python/paddle/fluid/tests/unittests/ir/inference/test_conv_elementwise_add2_act_fuse_pass.py @@ -12,18 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -from auto_scan_test import PassAutoScanTest, SkipReasons +from auto_scan_test import PassAutoScanTest from program_config import TensorConfig, ProgramConfig, OpConfig import numpy as np -import paddle.inference as paddle_infer -from functools import partial -from typing import Optional, List, Callable, Dict, Any, Set import unittest - -import hypothesis -from hypothesis import given, settings, seed, example, assume, reproduce_failure +import os import hypothesis.strategies as st +os.environ['NVIDIA_TF32_OVERRIDE'] = '0' + class TestConvElementwiseAdd2ActPass(PassAutoScanTest): """ @@ -62,11 +59,11 @@ class TestConvElementwiseAdd2ActPass(PassAutoScanTest): return False if padding_algorithm == "VALID": if int(((input_shape[2] - (dilations[0] * (filter_shape[2] - 1) + 1)) / strides[0] + 1)) <= 0 or \ - int(((input_shape[3] - (dilations[1] * (filter_shape[3] - 1) + 1)) / strides[1] + 1)) <= 0: + int(((input_shape[3] - (dilations[1] * (filter_shape[3] - 1) + 1)) / strides[1] + 1)) <= 0: return False if padding_algorithm == "EXPLICIT": if int(((input_shape[2] + paddings[0] + paddings[1] - (dilations[0] * (filter_shape[2] - 1) + 1)) / strides[0] + 1)) <= 0 or \ - int(((input_shape[3] + paddings[2] + paddings[3] - (dilations[1] * (filter_shape[3] - 1) + 1)) / strides[1] + 1)) <= 0: + int(((input_shape[3] + paddings[2] + paddings[3] - (dilations[1] * (filter_shape[3] - 1) + 1)) / strides[1] + 1)) <= 0: return False if padding_algorithm == "SAME": if int((input_shape[2] + strides[0] - 1) / strides[0]) <= 0 or int( @@ -137,17 +134,27 @@ class TestConvElementwiseAdd2ActPass(PassAutoScanTest): # 9. Generate legal elemntwise_add: X of conv2d bias_2_dict = dict() - bias_2_dict[1] = [x_shape[0], f_shape[0], \ - int(((x_shape[2] + padding[0] + padding[1] - (dilations[0] * (f_shape[2] - 1) + 1)) / strides[0] + 1)), \ - int(((x_shape[3] + padding[2] + padding[3] - (dilations[1] * (f_shape[3] - 1) + 1)) / strides[1] + 1))] - - bias_2_dict[2] = [x_shape[0], f_shape[0], \ - int((x_shape[2] + strides[0] - 1) / strides[0]), \ - int((x_shape[3] + strides[1] - 1) / strides[1])] - - bias_2_dict[3] = [x_shape[0], f_shape[0], \ - int(((x_shape[2] - (dilations[0] * (f_shape[2] - 1) + 1)) / strides[0] + 1)), \ - int(((x_shape[3] - (dilations[1] * (f_shape[3] - 1) + 1)) / strides[1] + 1))] + bias_2_dict[1] = [ + x_shape[0], f_shape[0], + int(((x_shape[2] + padding[0] + padding[1] - + (dilations[0] * (f_shape[2] - 1) + 1)) / strides[0] + 1)), + int(((x_shape[3] + padding[2] + padding[3] - + (dilations[1] * (f_shape[3] - 1) + 1)) / strides[1] + 1)) + ] + + bias_2_dict[2] = [ + x_shape[0], f_shape[0], + int((x_shape[2] + strides[0] - 1) / strides[0]), + int((x_shape[3] + strides[1] - 1) / strides[1]) + ] + + bias_2_dict[3] = [ + x_shape[0], f_shape[0], + int(((x_shape[2] - (dilations[0] * + (f_shape[2] - 1) + 1)) / strides[0] + 1)), + int(((x_shape[3] - (dilations[1] * + (f_shape[3] - 1) + 1)) / strides[1] + 1)) + ] bias_index = 1 if padding_algorithm == "SAME": bias_index = 2 diff --git a/python/paddle/fluid/tests/unittests/ir/inference/test_conv_elementwise_add_act_fuse_pass.py b/python/paddle/fluid/tests/unittests/ir/inference/test_conv_elementwise_add_act_fuse_pass.py index 72e15c04d99412863aac6f50629db13dfd7b9a8f..8756625eaf1dfe425db05d0a1321582b215b8220 100755 --- a/python/paddle/fluid/tests/unittests/ir/inference/test_conv_elementwise_add_act_fuse_pass.py +++ b/python/paddle/fluid/tests/unittests/ir/inference/test_conv_elementwise_add_act_fuse_pass.py @@ -12,18 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -from auto_scan_test import PassAutoScanTest, IgnoreReasons +from auto_scan_test import PassAutoScanTest from program_config import TensorConfig, ProgramConfig, OpConfig import numpy as np -import paddle.inference as paddle_infer -from functools import partial -from typing import Optional, List, Callable, Dict, Any, Set import unittest - -import hypothesis -from hypothesis import given, settings, seed, example, assume, reproduce_failure +import os import hypothesis.strategies as st +os.environ['NVIDIA_TF32_OVERRIDE'] = '0' + class TestConvElementwiseAddActPass(PassAutoScanTest): """ @@ -60,11 +57,11 @@ class TestConvElementwiseAddActPass(PassAutoScanTest): return False if padding_algorithm == "VALID": if ((input_shape[2] - (dilations[0] * (filter_shape[2] - 1) + 1)) / strides[0] + 1) <= 1 or \ - ((input_shape[3] - (dilations[1] * (filter_shape[3] - 1) + 1)) / strides[1] + 1) <= 1: + ((input_shape[3] - (dilations[1] * (filter_shape[3] - 1) + 1)) / strides[1] + 1) <= 1: return False if padding_algorithm == "EXPLICIT": if ((input_shape[2] + paddings[0] + paddings[1] - (dilations[0] * (filter_shape[2] - 1) + 1)) / strides[0] + 1) <= 1 or \ - ((input_shape[3] + paddings[2] + paddings[3] - (dilations[1] * (filter_shape[3] - 1) + 1)) / strides[1] + 1) <= 1: + ((input_shape[3] + paddings[2] + paddings[3] - (dilations[1] * (filter_shape[3] - 1) + 1)) / strides[1] + 1) <= 1: return False if data_format == "NCHW": if input_shape[1] != filter_shape[1] * groups: diff --git a/python/paddle/fluid/tests/unittests/ir/inference/test_conv_eltwiseadd_bn_fuse_pass.py b/python/paddle/fluid/tests/unittests/ir/inference/test_conv_eltwiseadd_bn_fuse_pass.py index 363ba4d765e7cccd64f14509909693ef224985fd..1fb0612c40243a3b876919f82ee8383b86721f3b 100755 --- a/python/paddle/fluid/tests/unittests/ir/inference/test_conv_eltwiseadd_bn_fuse_pass.py +++ b/python/paddle/fluid/tests/unittests/ir/inference/test_conv_eltwiseadd_bn_fuse_pass.py @@ -12,18 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -from auto_scan_test import PassAutoScanTest, SkipReasons +from auto_scan_test import PassAutoScanTest from program_config import TensorConfig, ProgramConfig, OpConfig import numpy as np -import paddle.inference as paddle_infer -from functools import partial -from typing import Optional, List, Callable, Dict, Any, Set import unittest +import os -import hypothesis -from hypothesis import given, settings, seed, example, assume, reproduce_failure import hypothesis.strategies as st +os.environ['NVIDIA_TF32_OVERRIDE'] = '0' + class TestConvEltwiseaddBnFusePass(PassAutoScanTest): """ @@ -69,11 +67,11 @@ class TestConvEltwiseaddBnFusePass(PassAutoScanTest): return False if padding_algorithm == "VALID": if ((input_shape[2] - (dilations[0] * (filter_shape[2] - 1) + 1)) / strides[0] + 1) <= 1 or \ - ((input_shape[3] - (dilations[1] * (filter_shape[3] - 1) + 1)) / strides[1] + 1) <= 1: + ((input_shape[3] - (dilations[1] * (filter_shape[3] - 1) + 1)) / strides[1] + 1) <= 1: return False if padding_algorithm == "EXPLICIT": if ((input_shape[2] + paddings[0] + paddings[1] - (dilations[0] * (filter_shape[2] - 1) + 1)) / strides[0] + 1) <= 1 or \ - ((input_shape[3] + paddings[2] + paddings[3] - (dilations[1] * (filter_shape[3] - 1) + 1)) / strides[1] + 1) <= 1: + ((input_shape[3] + paddings[2] + paddings[3] - (dilations[1] * (filter_shape[3] - 1) + 1)) / strides[1] + 1) <= 1: return False if data_format == "NCHW":