Skip to content

BroadcastingList2[int] returns List[float] in torchscript #39450

@fmassa

Description

@fmassa

In PyTorch 1.6.0.dev20200518, BroadcastingListN[int] returns a List[float] in torchscript, instead of a List[int].

In [1]: import torch; from torch.jit.annotations import BroadcastingList2

In [2]: def f(x: BroadcastingList2[int]):
   ...:     return x
   ...:

In [3]: ff = torch.jit.script(f)

In [4]: ff(1)
Out[4]: [1.0, 1.0]

In [5]: torch.__version__
Out[5]: '1.6.0.dev20200518'

It doesn't look like it is desired behavior? What is weird is that the underlying representation seems correct on its return type

In [6]: print(ff.code)
def f(x: List[int]) -> List[int]:
  return x

cc @suo

Metadata

Metadata

Assignees

Labels

oncall: jitAdd this issue/PR to JIT oncall triage queue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions