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<64x64x112x112xf32>' and result type 'tensor<1x64x112x112xf32>' are cast incompatible : Mul with broadcast + reshape #907

Open
pravg-amd opened this issue Feb 6, 2025 · 0 comments

Comments

@pravg-amd
Copy link

pravg-amd commented Feb 6, 2025

For the below IR,

module {
  func.func @inception_v2(%arg0: !torch.vtensor<[1,64,112,112],f32>, %arg1: !torch.vtensor<[64],f32>) ->  !torch.vtensor<[1,64,112,112],f32>  attributes {torch.onnx_meta.ir_version = 3 : si64, torch.onnx_meta.opset_version = 21 : si64, torch.onnx_meta.producer_name = "onnx-caffe2", torch.onnx_meta.producer_version = ""} {
    %0 = torch.operator "onnx.Constant"() {torch.onnx.value = dense<[1, 2, 3]> : tensor<3xsi64>} : () -> !torch.vtensor<[3],si64>
    %1 = torch.operator "onnx.Unsqueeze"(%arg1, %0) : (!torch.vtensor<[64],f32>, !torch.vtensor<[3],si64>) -> !torch.vtensor<[64,1,1,1],f32>
    %2 = torch.operator "onnx.Mul"(%arg0, %1) : (!torch.vtensor<[1,64,112,112],f32>, !torch.vtensor<[64,1,1,1],f32>) -> !torch.vtensor<[1,64,112,112],f32>
    return %2 : !torch.vtensor<[1,64,112,112],f32>
  }
}

Getting error as

model_torch_onnx.mlir:5:10: error: 'tensor.cast' op operand type 'tensor<64x64x112x112xf32>' and result type 'tensor<1x64x112x112xf32>' are cast incompatible
    %2 = torch.operator "onnx.Mul"(%arg0, %1) : (!torch.vtensor<[1,64,112,112],f32>, !torch.vtensor<[64,1,1,1],f32>) -> !torch.vtensor<[1,64,112,112],f32>

Command

iree-compile --iree-hal-target-backends=llvm-cpu --iree-llvmcpu-target-cpu=host -o test.vmfb model_torch_onnx.mlir

Model Impacted:
inception-v2-6

@pravg-amd pravg-amd changed the title Mul with broadcast requires reshape for inception-v2-6 'tensor.cast' op operand type 'tensor<64x64x112x112xf32>' and result type 'tensor<1x64x112x112xf32>' are cast incompatible : Mul with broadcast + reshape Feb 7, 2025
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