torch.operator

unsupported 操作符

或者更自然一些:

不受支持的操作

不过,根据原文“unsupported_operator”,如果要严格对应的话,“不受支持的操作符”更为准确。因此,建议使用:“不受支持的操作符”。

注意

标签: torch.operator

支持级别: 尚不支持

原版源代码:

# mypy: allow-untyped-defs
import torch
from torch._export.db.case import SupportLevel


class TorchSymMin(torch.nn.Module):
"""
    torch.sym_min operator is not supported in export.
    """

    def forward(self, x):
        return x.sum() + torch.sym_min(x.size(0), 100)


example_args = (torch.randn(3, 2),)
tags = {"torch.operator"}
support_level = SupportLevel.NOT_SUPPORTED_YET
model = TorchSymMin()


torch.export.export(model, example_args)

结果:

Unsupported: torch.* op returned non-Tensor int call_function <function sym_min at 0x7f98c3497040>
本页目录