From e5dfe4ed6fbf2bbe53f87d8e5fb55162b8ed41a3 Mon Sep 17 00:00:00 2001 From: Dom Miketa Date: Tue, 16 Mar 2021 10:06:25 +0000 Subject: [PATCH] format unittest Signed-off-by: Dom Miketa --- test/backend/test_dynamic_shape.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/backend/test_dynamic_shape.py b/test/backend/test_dynamic_shape.py index 86539091..9e738472 100644 --- a/test/backend/test_dynamic_shape.py +++ b/test/backend/test_dynamic_shape.py @@ -249,10 +249,12 @@ def test_conv_transpose(self): np.testing.assert_almost_equal(tf_model_output[0], test_output, decimal=5) def test_depth_to_space(self): - b,c,h,w = shape = [2, 48, 5, 6] + b, c, h, w = shape = [2, 48, 5, 6] blocksize = 4 x = self._get_rnd_float32(shape=shape) - node_def = helper.make_node("DepthToSpace", ["X"], ["Y"], blocksize=blocksize, mode="DCR") + node_def = helper.make_node("DepthToSpace", ["X"], ["Y"], + blocksize=blocksize, + mode="DCR") graph_def = helper.make_graph( [node_def], name="test_unknown_shape", @@ -260,7 +262,10 @@ def test_depth_to_space(self): helper.make_tensor_value_info("X", TensorProto.FLOAT, [None, None, None, None]) ], - outputs=[helper.make_tensor_value_info("Y", TensorProto.FLOAT, [None, None, None, None])]) + outputs=[ + helper.make_tensor_value_info("Y", TensorProto.FLOAT, + [None, None, None, None]) + ]) tf_rep = onnx_graph_to_tensorflow_rep(graph_def) # export to tf.saved_model model_path = 'test_dynamic_shape/depth_to_space' @@ -270,8 +275,8 @@ def test_depth_to_space(self): # run the model tf_model_output = tf_model(X=x) tmp = np.reshape(x, [b, blocksize, blocksize, c // (blocksize**2), h, w]) - tmp = np.transpose(tmp, [0, 3, 4, 1, 5 ,2]) - y = np.reshape(tmp, [b, c // (blocksize**2), h*blocksize, w*blocksize]) + tmp = np.transpose(tmp, [0, 3, 4, 1, 5, 2]) + y = np.reshape(tmp, [b, c // (blocksize**2), h * blocksize, w * blocksize]) np.testing.assert_almost_equal(tf_model_output[0], y) def test_eye_like(self):