You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "erdayang (via GitHub)" <gi...@apache.org> on 2025/02/24 06:52:42 UTC

[I] [Bug] Error converting operator Cast, with inputs: [R.shape([x_0, x_1])] [tvm]

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

   My model is onnx, I used to work with v0.15, it work successfully. But when I work with 0.20.dev0, I found the exception of cast operation.
   ### Expected behavior
   
   I expect to work successfully with main branch, because main branch have fixed  an Attention’s attr.
   
   ### Actual behavior
   
   <img width="351" alt="Image" src="https://github.com/user-attachments/assets/e75b97e2-fbde-4ea1-bafa-736482bb7657" />
   
   this is my graph, two cast operation , then first one have no problem , the second one does not work.
   
   ### Environment
   
   centos7.0
   gcc7.3.1
   tvm tag v0.20.dev0
   tvm work with cpu,  turn on the cmake option of "USE_LLVM"
   
   
   script  
   ```
   from tvm.relax.frontend.onnx import from_onnx
   
   mod,params = from_onnx(onnx_model)
   
   mod.show()
   
   ```
   
   error info   
   ```
   /home/admin/tvm_home/main/python/tvm/relax/frontend/onnx/onnx_frontend.py:3392: UserWarning: Renaming name 524289_a to input_524289_a
     warnings.warn(("Renaming name %s to %s" % (name, new_name)))
   Error converting operator Cast, with inputs: [R.shape([x_0, x_1])]
   Traceback (most recent call last):
     File "test.py", line 43, in <module>
       mod,params = from_onnx(onnx_model, shape_dict, type_dict, 16)
     File "/home/admin/tvm_home/main/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 3690, in from_onnx
       return g.from_onnx(graph, opset)
     File "/home/admin/tvm_home/main/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 3321, in from_onnx
       self._construct_nodes(graph)
     File "/home/admin/tvm_home/main/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 3501, in _construct_nodes
       raise err
     File "/home/admin/tvm_home/main/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 3498, in _construct_nodes
       op = self.bb.normalize(op)
     File "/home/admin/tvm_home/main/python/tvm/relax/block_builder.py", line 667, in normalize
       return _ffi_api.BlockBuilderNormalize(self, expr)  # type: ignore
     File "tvm/_ffi/_cython/./packed_func.pxi", line 339, in tvm._ffi._cy3.core.PackedFuncBase.__call__
     File "tvm/_ffi/_cython/./packed_func.pxi", line 270, in tvm._ffi._cy3.core.FuncCall
     File "tvm/_ffi/_cython/./packed_func.pxi", line 259, in tvm._ffi._cy3.core.FuncCall3
     File "tvm/_ffi/_cython/./base.pxi", line 185, in tvm._ffi._cy3.core.CHECK_CALL
     File "/home/admin/tvm_home/main/python/tvm/_ffi/base.py", line 465, in raise_last_ffi_error
       raise py_err
   tvm._ffi.base.TVMError: Traceback (most recent call last):
     10: _ZN3tvm7runtime13PackedFuncObj9ExtractorINS0_16PackedFuncSubObjIZNS0_15TypedPackedFuncIFNS_9RelaxExprENS_5relax12BlockBuilderERKS5_EE17AssignTypedLambdaIZNS0_8Registry15set_body_methodIS7_NS6_16BlockBuilderNodeES5_JS9_EvEERSD_MT0_FT1_DpT2_EEUlS7_S9_E_EEvT_SsEUlRKNS0_7TVMArgsEPNS0_11TVMRetValueEE_EEE4CallEPKS1_SP_ST_
     9: tvm::relax::Normalizer::Normalize(tvm::RelaxExpr const&)
     8: tvm::relax::Normalizer::VisitExpr(tvm::RelaxExpr const&)
     7: _ZZN3tvm5relax11ExprFunc
     6: tvm::relax::Normalizer::VisitExpr_(tvm::relax::CallNode const*)
     5: tvm::relax::Normalizer::InferStructInfo(tvm::relax::Call const&)
     4: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<void tvm::runtime::TypedPackedFunc<tvm::relax::StructInfo (tvm::relax::Call const&, tvm::relax::BlockBuilder const&)>::AssignTypedLambda<tvm::relax::StructInfo (*)(tvm::relax::Call const&, tvm::relax::BlockBuilder const&)>(tvm::relax::StructInfo (*)(tvm::relax::Call const&, tvm::relax::BlockBuilder const&))::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)
     3: tvm::relax::InferStructInfoAstype(tvm::relax::Call const&, tvm::relax::BlockBuilder const&)
     2: tvm::relax::GetInputTensorStructInfo(tvm::relax::Call const&, tvm::relax::BlockBuilder const&)
     1: tvm::relax::GetInputTensorStructInfo(tvm::relax::Call const&, unsigned long, tvm::relax::BlockBuilder const&)
     0: tvm::relax::BlockBuilderImpl::ReportFatal(tvm::Diagnostic const&)
     File "/home/admin/tvm_home/main/src/relax/ir/block_builder.cc", line 157
   TVMError: Operator Op(relax.astype) requires argument 0 (x) to be a tensor.  However, the argument R.shape([x_0, x_1]) is instead of type R.Shape([x_0, x_1])
   ```
   
   


-- 
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: commits-unsubscribe@tvm.apache.org.apache.org

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


Re: [I] [Bug] Error converting operator Cast, with inputs: [R.shape([x_0, x_1])] [tvm]

Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy closed issue #17671: [Bug] Error converting operator Cast, with inputs: [R.shape([x_0, x_1])]
URL: https://github.com/apache/tvm/issues/17671


-- 
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: commits-unsubscribe@tvm.apache.org

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


Re: [I] [Bug] Error converting operator Cast, with inputs: [R.shape([x_0, x_1])] [tvm]

Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy commented on issue #17671:
URL: https://github.com/apache/tvm/issues/17671#issuecomment-2681120499

   Would you please provide your onnx model or a subgraph that triggers the error?


-- 
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: commits-unsubscribe@tvm.apache.org

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


Re: [I] [Bug] Error converting operator Cast, with inputs: [R.shape([x_0, x_1])] [tvm]

Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy commented on issue #17671:
URL: https://github.com/apache/tvm/issues/17671#issuecomment-2705435555

   Closing it as no update for a long time. Feel free to reopen it if needed


-- 
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: commits-unsubscribe@tvm.apache.org

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