Skip to content

Commit

Permalink
Updated check_torch_conversion function to include output comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan-arm committed Aug 15, 2019
1 parent b870cc9 commit d104560
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/python/frontend/onnx/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,8 +1082,11 @@ def check_torch_conversion(model, input_size):
# Set verbose=True for more output
torch.onnx.export(model(), dummy_input, file_name, export_params=True, verbose=False)
onnx_model = onnx.load(file_name)
shapes = { onnx_model.graph.input[0].name : input_size }
expr, params = relay.frontend.from_onnx(onnx_model, shape=shapes)
for target, ctx in ctx_list():
input_data = np.random.uniform(size=input_size).astype('int32')
c2_out = get_caffe2_output(onnx_model, input_data)
tvm_out = get_tvm_output(onnx_model, input_data, target, ctx)
tvm.testing.assert_allclose(c2_out, tvm_out)

def test_resnet():
check_torch_conversion(torchvision.models.resnet18, (1,3,224,224))
Expand Down

0 comments on commit d104560

Please sign in to comment.