running this script:
import onnx
import torch
class MyModule(torch.nn.Module):
def forward(self):
return torch.repeat_interleave(torch.tensor([2]), 2, 0)
model = MyModule()
model.eval()
with torch.no_grad():
torch.onnx.export(model, (), optimize=False).save("output.onnx")
onnx.shape_inference.infer_shapes_path("output.onnx", strict_mode=True)
results in the following error:
onnx.onnx_cpp2py_export.shape_inference.InferenceError: [ShapeInferenceError] Inference error(s): (op_type:Identity, node name: node_repeat_interleave): [ShapeInferenceError] Inferred shape and existing shape differ in rank: (2) vs (1)
the issue is this line of code
.
This line checks the original rank, and not the current rank. It should therefore be:
if self_rank == 0:
versions of relevant packages:
onnx 1.20.0
onnx-ir 0.2.1
onnxscript 0.7.0
torch 2.11.0
running this script:
results in the following error:
onnx.onnx_cpp2py_export.shape_inference.InferenceError: [ShapeInferenceError] Inference error(s): (op_type:Identity, node name: node_repeat_interleave): [ShapeInferenceError] Inferred shape and existing shape differ in rank: (2) vs (1)the issue is this line of code
onnxscript/onnxscript/function_libs/torch_lib/ops/core.py
Line 8314 in c72e810
This line checks the original rank, and not the current rank. It should therefore be:
if self_rank == 0:versions of relevant packages: