jikechao opened a new issue, #16625:
URL: https://github.com/apache/tvm/issues/16625

   
   ### Actual behavior
   ```
   Traceback (most recent call last):
     File "test.py", line 55, in test_resize
       verify([1, 16] + [32] * ndim, [], [1, 1] + [2] * ndim, None, coord_trans)
     File "frontend/onnx/test_forward.py", line 4489, in verify
       verify_with_ort(
     File "frontend/onnx/test_forward.py", line 262, in verify_with_ort
       verify_with_ort_with_inputs(
     File "frontend/onnx/test_forward.py", line 213, in 
verify_with_ort_with_inputs
       tvm_out = get_tvm_output_with_vm(
     File "frontend/onnx/test_forward.py", line 95, in get_tvm_output_with_vm
       mod, params = relay.frontend.from_onnx(
     File "/home/shenqingchao/software/tvm/python/tvm/relay/frontend/onnx.py", 
line 7226, in from_onnx
       mod, params = g.from_onnx(graph, opset)
     File "/home/shenqingchao/software/tvm/python/tvm/relay/frontend/onnx.py", 
line 6845, in from_onnx
       self._construct_nodes(graph)
     File "/home/shenqingchao/software/tvm/python/tvm/relay/frontend/onnx.py", 
line 6960, in _construct_nodes
       op = self._convert_operator(op_name, inputs, attr, self.opset)
     File "/home/shenqingchao/software/tvm/python/tvm/relay/frontend/onnx.py", 
line 7084, in _convert_operator
       sym = convert_map[op_name](inputs, attrs, self._params)
     File "/home/shenqingchao/software/tvm/python/tvm/relay/frontend/onnx.py", 
line 3982, in _impl_v11
       return cls.v11_13_common(inputs, size, attr, params)
     File "/home/shenqingchao/software/tvm/python/tvm/relay/frontend/onnx.py", 
line 4016, in v11_13_common
       mode = attr.get("mode").decode("ascii")
   AttributeError: 'NoneType' object has no attribute 'decode'
   ```
   
   ### Steps to reproduce
   ```
   def test_resize(target, dev):
       """test_resize"""
   
       def verify(ishape, oshape, scales, mode, coord_trans="asymmetric", 
alpha=0.5, exclude=False):
           nodes = [
               make_constant_node("roi", onnx.TensorProto.FLOAT, (0,), []),
               make_constant_node("scales", onnx.TensorProto.FLOAT, 
(len(scales),), scales),
           ]
           input_names = ["X", "roi", "scales"]
   
           if oshape != []:
               nodes.append(
                   make_constant_node("sizes", onnx.TensorProto.INT64, 
(len(oshape),), oshape)
               )
               input_names.append("sizes")
           nodes.append(
               helper.make_node(
                   "Resize",
                   inputs=input_names,
                   outputs=["Y"],
                   mode=mode,
                   coordinate_transformation_mode=coord_trans,
                   cubic_coeff_a=alpha,
                   exclude_outside=exclude,
               )
           )
   
           if oshape == []:
               oshape = [round(dim * scale) for (dim, scale) in zip(ishape, 
scales)]
           graph = helper.make_graph(
               nodes,
               "resize_test",
               inputs=[helper.make_tensor_value_info("X", TensorProto.FLOAT, 
ishape)],
               outputs=[helper.make_tensor_value_info("Y", TensorProto.FLOAT, 
oshape)],
           )
   
           verify_with_ort(
               model,
               [ishape],
               [oshape],
               use_vm=True,
               opset=11,
               freeze_params=True,
               target=target,
               dev=dev,
           )
   
       for ndim in [1, 2, 3]:
           method = "nearest"
           for coord_trans in ["asymmetric", "align_corners", "half_pixel"]:
               verify([1, 16] + [32] * ndim, [], [1, 1] + [2] * ndim, None, 
coord_trans)
   test_resize('llvm', tvm.cpu(0))
   ```
   
   ### Triage
   * front::onnx
   * needs-triage
   
   
   ### Analysis
   The attribute `mode` of the `Resize` operator is optional with the default 
value "nearest". TVM can not parse the None correctly.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to