89e81228719825b36d6278276efcd6fc146574a3,tensorflow/python/grappler/layout_optimizer_test.py,LayoutOptimizerTest,testConv3D,#LayoutOptimizerTest#,1438
Before Change
@test_util.deprecated_graph_mode_only
def testConv3D(self):
if not test.is_gpu_available(cuda_only=True):
self.skipTest("GPU required")
random_seed.set_random_seed(0)
x = random_ops.truncated_normal([2, 2, 14, 14, 1], seed=0)
w = random_ops.truncated_normal([2, 2, 2, 1, 2], seed=0)
strides = [1, 1, 1, 1, 1]
After Change
@test_util.deprecated_graph_mode_only
def testConv3D(self):
if test.is_gpu_available(cuda_only=True):
random_seed.set_random_seed(0)
x = random_ops.truncated_normal([1, 784], seed=0)
conv = _two_layer_model(x)
filters = random_ops.truncated_normal([2, 2, 2, 1, 2], seed=0)
strides_val = [1, 1, 1, 1, 1]
x_3d = array_ops.reshape(conv, [-1, 4, 14, 14, 1])
conv3d = gen_nn_ops.conv3d(x_3d, filters, strides_val, "VALID")
output = array_ops.identity(conv3d)
with session.Session(config=_get_config(False)) as sess:
output_val_ref = sess.run(output)
with session.Session(config=_get_config()) as sess:
metadata = config_pb2.RunMetadata()
output_val = sess.run(output, run_metadata=metadata)
nodes = []
num_transposes = 0
for node in metadata.cost_graph.node:
if _is_transpose(node.name):
num_transposes += 1
nodes.append(node.name)
expected_num_transposes = 2
self.assertEqual(expected_num_transposes, num_transposes)
self._assert_trans_nhwc_to_nchw("Conv2D-0", nodes)
self._assert_trans_ndhwc_to_ncdhw("Conv3D-0", nodes)
self._assert_trans_ncdhw_to_ndhwc("Conv3D-0-0", nodes)
self.assertAllClose(output_val_ref, output_val, atol=1e-3)
@test_util.deprecated_graph_mode_only
def testConv3DBackpropInput(self):
if test.is_gpu_available(cuda_only=True):
random_seed.set_random_seed(0)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 13
Instances
Project Name: tensorflow/tensorflow
Commit Name: 89e81228719825b36d6278276efcd6fc146574a3
Time: 2020-10-30
Author: gardener@tensorflow.org
File Name: tensorflow/python/grappler/layout_optimizer_test.py
Class Name: LayoutOptimizerTest
Method Name: testConv3D
Project Name: tensorflow/tensorflow
Commit Name: 89e81228719825b36d6278276efcd6fc146574a3
Time: 2020-10-30
Author: gardener@tensorflow.org
File Name: tensorflow/python/grappler/layout_optimizer_test.py
Class Name: LayoutOptimizerTest
Method Name: testConv3DBackpropInput
Project Name: tensorflow/tensorflow
Commit Name: 89e81228719825b36d6278276efcd6fc146574a3
Time: 2020-10-30
Author: gardener@tensorflow.org
File Name: tensorflow/python/grappler/layout_optimizer_test.py
Class Name: LayoutOptimizerTest
Method Name: testConv3DBackpropFilter