kice commented on issue #4531: Fix wrong NHWC shape parameters for cudnn conv2d
URL: https://github.com/apache/incubator-tvm/pull/4531#issuecomment-566470339
 
 
   Here is the code I used for testing. If the existing test case is correct, 
then there is something wrong with mxnet import. And I also used a pre-train 
model for testing, but the output is garbage. I assume the shape was mess up 
somewhere.
   
   ```
   data = mx.sym.var('data')
   sym = mx.sym.Convolution(data, dilate=(1, 1), kernel=(4, 5), no_bias=False, 
num_filter=64, num_group=1, pad=[1, 1], stride=(1, 1), layout='NHWC')
   
   arg_params = {}
   aux_params = {}
   
   dtype = 'float16'
   input_shape = (1, 720, 1280, 3)
   
   shape_dict = {'data': input_shape}
   mod, params = relay.frontend.from_mxnet(sym, shape_dict, dtype, arg_params, 
aux_params)
   
   func = mod["main"]
   
   target = tvm.target.create('cuda -libs=cudnn')
   with relay.build_config(opt_level=3):
       graph, lib, params = relay.build(func, target, params=params)
   
   ctx = tvm.gpu(0)
   x = np.ones(input_shape).astype(dtype)
   
   m = graph_runtime.create(graph, lib, ctx)
   m.set_input(input_name, tvm.nd.array(x))
   m.set_input(**params)
   
   m.run()
   tvm_output = m.get_output(0)
   print(tvm_output.shape)
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to