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.dim' op unexpected during shape cleanup; dynamic dimensions must have been resolved prior to leaving the flow dialect #876

Open
pdhirajkumarprasad opened this issue Nov 4, 2024 · 0 comments

Comments

@pdhirajkumarprasad
Copy link

for the given IR

module {
  func.func @"torch-jit-export"(%arg0: !torch.vtensor<[?,6],f32>) -> (!torch.vtensor<[?,1],si64> ) attributes {torch.onnx_meta.ir_version = 6 : si64, torch.onnx_meta.opset_version = 21 : si64, torch.onnx_meta.producer_name = "pytorch", torch.onnx_meta.producer_version = "1.7"} {
    %1 = torch.operator "onnx.Constant"() {torch.onnx.value = dense<0> : tensor<1xsi64>} : () -> !torch.vtensor<[1],si64> 
    %2 = torch.operator "onnx.Constant"() {torch.onnx.value = dense<4> : tensor<1xsi64>} : () -> !torch.vtensor<[1],si64> 
    %3 = torch.operator "onnx.Constant"() {torch.onnx.value = dense<1> : tensor<1xsi64>} : () -> !torch.vtensor<[1],si64> 
    %4 = torch.operator "onnx.Slice"(%arg0, %1, %2, %3) : (!torch.vtensor<[?,6],f32>, !torch.vtensor<[1],si64>, !torch.vtensor<[1],si64>, !torch.vtensor<[1],si64>) -> !torch.vtensor<[?,4],f32> 
    %5 = torch.operator "onnx.Softmax"(%4) {torch.onnx.axis = -1 : si64} : (!torch.vtensor<[?,4],f32>) -> !torch.vtensor<[?,4],f32> 
    %6 = torch.operator "onnx.Log"(%5) : (!torch.vtensor<[?,4],f32>) -> !torch.vtensor<[?,4],f32> 
    %7 = torch.operator "onnx.Multinomial"(%6) {torch.onnx.dtype = 7 : si64, torch.onnx.sample_size = 1 : si64} : (!torch.vtensor<[?,4],f32>) -> !torch.vtensor<[?,1],si64> 
    return %7 : !torch.vtensor<[?,1],si64>
  }
}

getting error as

model.torch_onnx.mlir:9:10: error: 'tensor.dim' op unexpected during shape cleanup; dynamic dimensions must have been resolved prior to leaving the flow dialect
    %7 = torch.operator "onnx.Multinomial"(%6) {torch.onnx.dtype = 7 : si64, torch.onnx.sample_size = 1 : si64} : (!torch.vtensor<[?,4],f32>) -> !torch.vtensor<[?,1],si64> 
         ^

command : iree-compile --iree-hal-target-backends=llvm-cpu -o abc.vmfb model.torch_onnx.mlir --iree-llvmcpu-target-cpu=host

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