You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by GitBox <gi...@apache.org> on 2021/10/19 16:16:07 UTC

[GitHub] [incubator-mxnet] PawelGlomski-Intel commented on issue #20659: onnx - output of network produces different results

PawelGlomski-Intel commented on issue #20659:
URL: https://github.com/apache/incubator-mxnet/issues/20659#issuecomment-946883383


   I assume you are using CPU and v1.x as you described [here](https://github.com/apache/incubator-mxnet/issues/11203#issuecomment-946223038).
   Does this code reproduce your issue?
   ```
   import torch
   import numpy as np
   import mxnet as mx
   
   
   class TestDeconvTorch(torch.nn.Module):
   
       def __init__(self):
           super(TestDeconvTorch, self).__init__()
           self.deconv1 = torch.nn.ConvTranspose2d(1, 8, 4)
           self.deconv2 = torch.nn.ConvTranspose2d(8, 8, 4)
           self.deconv3 = torch.nn.ConvTranspose2d(8, 1, 4)
   
       def forward(self, x):
           return self.deconv3(self.deconv2(self.deconv1(x)))
   
   
   data = torch.linspace(0, 1, 64).reshape((1, 1, 8, 8))
   tester = TestDeconvTorch()
   outt = tester(data)
   
   torch_onnx_export_output = torch.onnx.export(
       tester,
       data,
       'onnx_test',
       verbose=True,
       keep_initializers_as_inputs=True,
       export_params=True,
       enable_onnx_checker=True,
       do_constant_folding=False,
       opset_version=11,
   )
   
   sym_block = mx.contrib.onnx.import_to_gluon('onnx_test', ctx=mx.cpu())
   outm = sym_block.forward(mx.nd.array(data.numpy()))
   
   assert np.all(outm.asnumpy() == outt.detach().numpy())
   ```
   For me, it runs just fine


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org