Skip to content

Commit

Permalink
format unittest
Browse files Browse the repository at this point in the history
Signed-off-by: Dom Miketa <[email protected]>
  • Loading branch information
d-miketa committed Mar 16, 2021
1 parent 86d0f1f commit e5dfe4e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/backend/test_dynamic_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,18 +249,23 @@ 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",
inputs=[
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'
Expand All @@ -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):
Expand Down

0 comments on commit e5dfe4e

Please sign in to comment.