masahi commented on a change in pull request #4604: [FRONTEND][TF] Add conv3d
URL: https://github.com/apache/incubator-tvm/pull/4604#discussion_r362181043
##########
File path: tests/python/frontend/tensorflow/test_forward.py
##########
@@ -469,6 +472,57 @@ def test_forward_convolution():
'NHWC', [1, 8, 8, 1])
+#######################################################################
+# Convolution3D
+# -----------
+
+
+def _test_convolution3d(opname, tensor_in_sizes, filter_in_sizes,
+ dilations, strides, padding, data_format,
+ deconv_output_shape=[]):
+ """ One iteration of 3D convolution with given shapes and attributes """
+
+ total_size_1 = np.prod(tensor_in_sizes)
+ total_size_2 = np.prod(filter_in_sizes)
+ # Initializes the input tensor with array containing incrementing
+ # numbers from 1.
+ data_array = [f * 1.0 for f in range(1, total_size_1 + 1)]
+ filter_array = [f * 1.0 for f in range(1, total_size_2 + 1)]
+
+ with tf.Graph().as_default():
+ in_data = array_ops.placeholder(shape=tensor_in_sizes, dtype='float32')
+ in_filter = constant_op.constant(
+ filter_array, shape=filter_in_sizes, dtype='float32')
+ if data_format == 'NDHWC':
+ strides = [1] + strides + [1]
+ dilations = [1] + dilations + [1]
+ else:
+ strides = [1, 1] + strides
+ dilations = [1, 1] + dilations
+
+ if opname == 'conv':
+ nn_ops.conv3d(in_data,
+ in_filter,
+ strides=strides,
+ dilations=dilations,
+ padding=padding,
+ data_format=data_format)
+
+ compare_tf_with_tvm(np.reshape(data_array,
tensor_in_sizes).astype('float32'),
+ 'Placeholder:0', 'Conv3D:0', assert_rtol=1e-2,
cuda_layout="NCDHW")
Review comment:
Why such low rtol?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services