-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
For the below IR,
func.func @main(%arg0: !torch.vtensor<[],si64>, %arg1: !torch.vtensor<[],i1>, %arg2: !torch.vtensor<[],si32>, %arg3: !torch.vtensor<[],si32>) -> (!torch.vtensor<[],si32>, !torch.vtensor<[?],si32>) attributes {torch.onnx_meta.ir_version = 6 : si64, torch.onnx_meta.opset_version = 21 : si64, torch.onnx_meta.producer_name = "keras2onnx", torch.onnx_meta.producer_version = "1.6.0"} {
%0:2 = torch.operator "onnx.Loop"(%arg0, %arg1, %arg2) : (!torch.vtensor<[],si64>, !torch.vtensor<[],i1>, !torch.vtensor<[],si32>) -> (!torch.vtensor<[],si32>, !torch.vtensor<[?],si32>) {
^bb0(%arg4: !torch.vtensor<[],si64>, %arg5: !torch.vtensor<[],i1>, %arg6: !torch.vtensor<[],si32>):
%592 = torch.operator "onnx.Add"(%arg6, %arg3) : (!torch.vtensor<[],si32>, !torch.vtensor<[],si32>) -> !torch.vtensor<[],si32>
%593 = torch.operator "onnx.Identity"(%arg6) : (!torch.vtensor<[],si32>) -> !torch.vtensor<[],si32>
%594 = torch.operator "onnx.Identity"(%arg5) : (!torch.vtensor<[],i1>) -> !torch.vtensor<[],i1>
torch.operator_terminator %594, %592, %593 : !torch.vtensor<[],i1>, !torch.vtensor<[],si32>, !torch.vtensor<[],si32>
}
return %0#0, %0#1 : !torch.vtensor<[],si32>, !torch.vtensor<[?],si32>
}
Getting error as
model_torch_onnx.mlir:2:10: error: failed to legalize operation 'torch.operator' that was explicitly marked illegal
%0:2 = torch.operator "onnx.Loop"(%arg0, %arg1, %arg2) : (!torch.vtensor<[],si64>, !torch.vtensor<[],i1>, !torch.vtensor<[],si32>) -> (!torch.vtensor<[],si32>, !torch.vtensor<[?],si32>) {
^
model_torch_onnx:2:10: note: see current operation:
%0:2 = "torch.operator"(%arg0, %arg1, %arg2) <{name = "onnx.Loop"}> ({
^bb0(%arg4: !torch.vtensor<[],si64>, %arg5: !torch.vtensor<[],i1>, %arg6: !torch.vtensor<[],si32>):
%1 = "torch.operator"(%arg6, %arg3) <{name = "onnx.Add"}> : (!torch.vtensor<[],si32>, !torch.vtensor<[],si32>) -> !torch.vtensor<[],si32>
%2 = "torch.operator"(%arg6) <{name = "onnx.Identity"}> : (!torch.vtensor<[],si32>) -> !torch.vtensor<[],si32>
%3 = "torch.operator"(%arg5) <{name = "onnx.Identity"}> : (!torch.vtensor<[],i1>) -> !torch.vtensor<[],i1>
"torch.operator_terminator"(%3, %1, %2) : (!torch.vtensor<[],i1>, !torch.vtensor<[],si32>, !torch.vtensor<[],si32>) -> ()
}) : (!torch.vtensor<[],si64>, !torch.vtensor<[],i1>, !torch.vtensor<[],si32>) -> (!torch.vtensor<[],si32>, !torch.vtensor<[?],si32>)
Command
iree-compile --iree-hal-target-backends=llvm-cpu --iree-llvmcpu-target-cpu=host -o test.vmfb model_torch_onnx.mlir
Models Impacted:
ssd_mobilenet_v1_10
ssd_mobilenet_v1_12
ssd_mobilenet_v1_12-int8
ssd_mobilenet_v1_13-qdq
tiny-yolov3-11
yolov3-10
yolov3-12
Metadata
Metadata
Assignees
Labels
No labels