Commit 9339d31f by thefiddler Committed by Tianqi Chen

Add test for issue #327 (#328)

* Added test for adding down-/up-sampled layers

* Enabled test for adding down-/up-sampled layers

* Normalize whitespace
parent 82de081c
...@@ -38,7 +38,7 @@ def verify_keras_frontend(keras_model): ...@@ -38,7 +38,7 @@ def verify_keras_frontend(keras_model):
tvm_out = get_tvm_output(x.transpose([0,3,1,2]), target, ctx) tvm_out = get_tvm_output(x.transpose([0,3,1,2]), target, ctx)
np.testing.assert_allclose(keras_out, tvm_out, rtol=1e-5, atol=1e-5) np.testing.assert_allclose(keras_out, tvm_out, rtol=1e-5, atol=1e-5)
def test_forward_elemwise_add(): def test_forward_elemwise_add():
print("test_forward_elemwise_add") print("test_forward_elemwise_add")
r = [] r = []
...@@ -58,6 +58,16 @@ def test_forward_elemwise_add(): ...@@ -58,6 +58,16 @@ def test_forward_elemwise_add():
y = keras.layers.GlobalAveragePooling2D()(y) y = keras.layers.GlobalAveragePooling2D()(y)
keras_model = keras.models.Model(data, y) keras_model = keras.models.Model(data, y)
verify_keras_frontend(keras_model) verify_keras_frontend(keras_model)
def test_forward_elementwise_add2():
data = keras.layers.Input(shape=(32,32,3))
r = keras.layers.Conv2D(10, (3, 3), padding="same")(data)
x = keras.layers.Conv2D(10, (3, 3), strides=(2, 2), padding="same")(data)
x = keras.layers.UpSampling2D()(x)
x = keras.layers.add([x, r])
x = keras.layers.GlobalAveragePooling2D()(x)
keras_model = keras.models.Model(data, x)
def test_forward_softrelu(): def test_forward_softrelu():
...@@ -136,6 +146,7 @@ def test_forward_resnet50(): ...@@ -136,6 +146,7 @@ def test_forward_resnet50():
if __name__ == '__main__': if __name__ == '__main__':
test_forward_elemwise_add() test_forward_elemwise_add()
test_forward_elementwise_add2()
test_forward_softrelu() test_forward_softrelu()
test_forward_leaky_relu() test_forward_leaky_relu()
test_forward_dense() test_forward_dense()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment