nod-ai / SHARK-ModelDev

Unified compiler/runtime for interfacing with PyTorch Dynamo.
Apache License 2.0
92 stars 46 forks source link

Failed to legalize operation `onnx.Resize`. #814

Open vinayakdsci opened 2 weeks ago

vinayakdsci commented 2 weeks ago

The ONNX operator onnx.Resize fails with Failed to legalize operation 'onnx.Resize' during lowering , as reported in https://github.com/nod-ai/SHARK-Turbine/issues/812

module {
  func.func @torch_jit(%arg0: !torch.vtensor<[1,3,240,240],f32>, %arg1: !torch.vtensor<[4],si64>) -> !torch.vtensor<[1,3,224,224],f32>  attributes {torch.onnx_meta.ir_version = 7 : si64, torch.onnx_meta.opset_version = 21 : si64, torch.onnx_meta.producer_name = "pytorch", torch.onnx_meta.producer_version = "1.12.1"} {
    %none = torch.constant.none
    %497 = torch.operator "onnx.Resize"(%arg0, %none, %none, %arg1) {torch.onnx.coordinate_transformation_mode = "pytorch_half_pixel", torch.onnx.cubic_coeff_a = -7.500000e-01 : f32, torch.onnx.mode = "cubic", torch.onnx.nearest_mode = "floor"} : (!torch.vtensor<[1,3,240,240],f32>, !torch.none, !torch.none, !torch.vtensor<[4],si64>) -> !torch.vtensor<[1,3,224,224],f32> 
    return %497 : !torch.vtensor<[1,3,224,224],f32>
  }
}

command to reproduce:

torch-mlir-opt -split-input-file -verify-diagnostics -convert-torch-onnx-to-torch --mlir-print-ir-after-all t1.mlir
kumardeepakamd commented 2 weeks ago

@aldesilv seems to have worked on this (https://github.com/llvm/torch-mlir/commit/ec6d7aa5d28f110aa5b893e16e502e6198988801 )