Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'tensor.cast' op operand type 'tensor<80x15130xf32>' and result type 'tensor<15130xf32>' are cast incompatible #891

Open
pdhirajkumarprasad opened this issue Dec 5, 2024 · 0 comments

Comments

@pdhirajkumarprasad
Copy link

For the given IR

module {
  func.func @"torch-jit-export"(%arg0: !torch.vtensor<[1,3,1200,1200],f32>, %arg1: !torch.vtensor<[1,15130,4],f32>, %arg2: !torch.vtensor<[1,80,15130],f32>) -> (!torch.vtensor<[?,3],si64> ) attributes {torch.onnx_meta.ir_version = 4 : si64, torch.onnx_meta.opset_version = 21 : si64, torch.onnx_meta.producer_name = "pytorch", torch.onnx_meta.producer_version = "1.1"} {

    %727 = torch.operator "onnx.Constant"() {torch.onnx.value = dense_resource<__177> : tensor<1xsi64>} : () -> !torch.vtensor<[1],si64> 
    %728 = torch.operator "onnx.ConstantOfShape"(%727) {torch.onnx.value = dense_resource<__178> : tensor<1xsi64>} : (!torch.vtensor<[1],si64>) -> !torch.vtensor<[1],si64> 
    %729 = torch.operator "onnx.Constant"() {torch.onnx.value = dense_resource<__179> : tensor<1xsi64>} : () -> !torch.vtensor<[1],si64> 
    %730 = torch.operator "onnx.ConstantOfShape"(%729) {torch.onnx.value = dense_resource<__180> : tensor<1xf32>} : (!torch.vtensor<[1],si64>) -> !torch.vtensor<[1],f32> 
    %731 = torch.operator "onnx.Constant"() {torch.onnx.value = dense_resource<__181> : tensor<1xsi64>} : () -> !torch.vtensor<[1],si64> 
    %732 = torch.operator "onnx.ConstantOfShape"(%731) {torch.onnx.value = dense_resource<__182> : tensor<1xf32>} : (!torch.vtensor<[1],si64>) -> !torch.vtensor<[1],f32> 
    %733 = torch.operator "onnx.NonMaxSuppression"(%arg1, %arg2, %728, %730, %732) : (!torch.vtensor<[1,15130,4],f32>, !torch.vtensor<[1,80,15130],f32>, !torch.vtensor<[1],si64>, !torch.vtensor<[1],f32>, !torch.vtensor<[1],f32>) -> !torch.vtensor<[?,3],si64> 

    return %733 : !torch.vtensor<[?,3],si64> 
  }
}

{-#
  dialect_resources: {
    builtin: {
      __177: "0x080000000100000000000000",
      __178: "0x08000000C800000000000000",
      __179: "0x080000000100000000000000",
      __180: "0x080000000000003F",
      __181: "0x080000000100000000000000",
      __182: "0x08000000CDCC4C3D"
    }
  }
#-}

getting error as

../model.torch_onnx.mlir:10:12: error: 'tensor.cast' op operand type 'tensor<80x15130xf32>' and result type 'tensor<15130xf32>' are cast incompatible
    %733 = torch.operator "onnx.NonMaxSuppression"(%arg1, %arg2, %728, %730, %732) : (!torch.vtensor<[1,15130,4],f32>, !torch.vtensor<[1,80,15130],f32>, !torch.vtensor<[1],si64>, !torch.vtensor<[1],f32>, !torch.vtensor<[1],f32>) -> !torch.vtensor<[?,3],si64> 

command:

iree-compile --iree-hal-target-backends=llvm-cpu --iree-llvmcpu-target-cpu=host -o abc.vmfb model.torch_onnx.mlir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant