未验证 提交 d150c3a6 编写于 作者: Y Yuanle Liu 提交者: GitHub

test=infer-coverage fix passes test bug on A10 (#46480)

上级 091ae705
......@@ -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.
......
......@@ -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
......
......@@ -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:
......
......@@ -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":
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册