Merge pull request #39412 from psunn:TransposeConvBias_TEST

PiperOrigin-RevId: 311778516
Change-Id: I43c15aef6b2c929beeafa46519400f814876ecd2
This commit is contained in:
TensorFlower Gardener 2020-05-15 12:26:46 -07:00
commit aa002d9a78
1 changed files with 23 additions and 1 deletions

View File

@ -38,6 +38,7 @@ def make_transpose_conv_tests(options):
{
"input_shape": [[1, 3, 4, 1], [1, 10, 10, 3], [3, 20, 20, 1]],
"filter_size": [[1, 1], [1, 2], [3, 3]],
"has_bias": [False],
"strides": [[1, 1, 1, 1], [1, 3, 3, 1]],
"padding": ["SAME", "VALID"],
"data_format": ["NHWC"],
@ -50,6 +51,7 @@ def make_transpose_conv_tests(options):
{
"input_shape": [[1, 3, 3, 1]],
"filter_size": [[3, 3, 2, 1]],
"has_bias": [False],
"strides": [[1, 1, 1, 1]],
"padding": ["SAME"],
"data_format": ["NHWC"],
@ -60,6 +62,7 @@ def make_transpose_conv_tests(options):
{
"input_shape": [[1, 3, 3, 1]],
"filter_size": [[3, 3, 2, 1]],
"has_bias": [False],
"strides": [[1, 2, 2, 1]],
"padding": ["SAME"],
"data_format": ["NHWC"],
@ -70,13 +73,25 @@ def make_transpose_conv_tests(options):
{
"input_shape": [[1, 4, 3, 1]],
"filter_size": [[3, 3, 2, 1]],
"has_bias": [False],
"strides": [[1, 2, 2, 1]],
"padding": ["SAME"],
"data_format": ["NHWC"],
"channel_multiplier": [1],
"output_shape": [[1, 8, 6, 2]],
"fully_quantize": [True]
}
},
{
"input_shape": [[1, 3, 3, 1]],
"filter_size": [[3, 3, 2, 1]],
"has_bias": [True],
"strides": [[1, 1, 1, 1]],
"padding": ["SAME"],
"data_format": ["NHWC"],
"channel_multiplier": [1],
"output_shape": [[1, 3, 3, 2]],
"fully_quantize": [True]
},
]
def get_tensor_shapes(parameters):
@ -124,6 +139,13 @@ def make_transpose_conv_tests(options):
strides=parameters["strides"],
padding=parameters["padding"],
data_format=parameters["data_format"])
if parameters["has_bias"]:
bias_input = create_tensor_data(
np.float32, (parameters["output_shape"][-1],),
min_value=-1,
max_value=1)
out = tf.nn.bias_add(
out, bias_input, data_format=parameters["data_format"])
return input_tensors, [out]