Skip to content

✨[Feature] Support aten::Int.Tensor(Tensor a) -> (int) #707

@ruoqianguo

Description

@ruoqianguo

Is your feature request related to a problem? Please describe.

I think "aten::Int" is a common function. Conversion failed because converter aten::Int.Tensor(Tensor a) -> (int) was missing. There is a subgraph about using it.

const auto graph = R"IR(
      graph(%0 : Tensor):
        %1 : int = prim::Constant[value=0]()
        %1.1 : int = prim::Constant[value=1]()
        %1.2 : int = prim::Constant[value=2]()
        %2 : int = aten::size(%0, %1)
        %2.1 : int = aten::size(%0, %1.1)
        %2.2 : int = aten::size(%0, %1.2)
        %3 : Tensor = prim::NumToTensor(%2.1)
        %4 : Tensor = prim::NumToTensor(%2.2)
        %5 : Tensor = aten::mul(%3, %4)
        %6 : int = aten::Int(%5)
        %7 : int[] = prim::ListConstruct(%2, %6)
        %8 : Tensor = aten::view(%0, %7)
        return (%8))IR";

Input could be at::randint(1, 10, {4, 3, 10}, {at::kCUDA})
Describe the solution you'd like

Add a converter.
Describe alternatives you've considered

Additional context

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions