[Bug]: No translation for torch.sym_float
OpenVINO Version
-- OpenVINO version is 2027.0.0 (Build 24075)
Operating System
Ubuntu 24.04 (LTS)
Device used for inference
CPU
Framework
PyTorch
Model used
No response
Issue description
Converting an exported module that calls torch.sym_float on a dynamic dimension fails. torch.export works, but ov.convert_model stops with "No conversion rule found for operations" for sym_float.
op_table.cpp in the PyTorch frontend has entries for torch.sym_min and torch.sym_max, but none for torch.sym_float.
I expected the model to convert and to give the same result as PyTorch, also for a batch size different from the one used for export.
According to the Hugging Face tracker, this blocks exporting Deformable DETR, FocalNet, Mask2Former and DeepSeek-OCR2: https://github.com/huggingface/transformers/issues/51306 (item 1)
I am working on a fix and will open a PR.
Step-by-step reproduction
- Build OpenVINO with the Python API and the PyTorch frontend, and install torch.
- Save this as repro.py:
import numpy as np, torch, openvino as ov
class M(torch.nn.Module):
def forward(self, x):
return x * torch.sym_float(x.shape[0])
ex = (torch.randn(4, 2),)
ep = torch.export.export(M(), ex, dynamic_shapes=({0: torch.export.Dim.AUTO},))
c = ov.compile_model(ov.convert_model(ep, example_input=ex), "CPU")
for n in (4, 9, 2):
x = torch.randn(n, 2)
np.testing.assert_allclose(c(x.numpy())[0], M()(x).numpy(), rtol=1e-5)
print("rows", n, "OK")
- Run: python repro.py
Relevant log output
FrontEnd API failed with OpConversionFailure:
Model wasn't fully converted.
Summary:
-- No conversion rule found for operations: <function sym_float at 0x7ff84c9a1760>
Issue submission checklist
- [x] I'm reporting an issue. It's not a question.
- [x] I checked the problem with the documentation, FAQ, open issues, Stack Overflow, etc., and have not found a solution.
- [x] There is reproducer code and related data files such as images, videos, models, etc.