Skip to content

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

@pdhirajkumarprasad

Description

@pdhirajkumarprasad

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions