Skip to content

[JIT][script] JIT for torch.norm ignores argument defaults #20113

@milos-popovic

Description

@milos-popovic

🐛 Bug

torch.norm p argument default is ignored by JIT

To Reproduce

Steps to reproduce the behavior:

import torch

@torch.jit.script
def norm_test():
  t = torch.ones(10, 5)
  return torch.norm(t, dim=1, keepdim=True)

fails with:

RuntimeError:
arguments for call are not valid:

for operator aten::norm(Tensor self, Scalar p=) -> Tensor:
keyword argument dim unknown

for operator aten::norm(Tensor self, Scalar? p, *, int dtype) -> Tensor:
argument p not provided.
@torch.jit.script
def norm_test():
t = torch.ones(10, 5)
return torch.norm(t, dim=1, keepdim=True)
~~~~~~~~~~ <--- HERE

import torch

@torch.jit.script
def norm_test():
  t = torch.ones(10, 5)
  return torch.norm(t, p=2, dim=1)

Works fine

Environment

Collecting environment information...
PyTorch version: 1.1.0
Is debug build: No
CUDA used to build PyTorch: 9.0

OS: Microsoft Windows 10 Pro
GCC version: Could not collect
CMake version: version 3.9.0-rc5

Python version: 3.6
Is CUDA available: Yes
CUDA runtime version: 9.0.176
GPU models and configuration: GPU 0: GeForce GTX 1080 Ti
Nvidia driver version: 419.67
cuDNN version: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin\cudnn64_7.dll

Versions of relevant libraries:
[pip] numpy==1.14.3
[pip] numpydoc==0.8.0
[pip] pytorch-ignite==0.1.0
[pip] torch==1.1.0
[pip] torchvision==0.2.2
[conda] blas 1.0 mkl
[conda] cuda91 1.0 0 pytorch
[conda] cuda92 1.0 0 pytorch
[conda] mkl 2018.0.2 1
[conda] mkl-service 1.1.2 py36h57e144c_4
[conda] mkl_fft 1.0.1 py36h452e1ab_0
[conda] mkl_random 1.0.1 py36h9258bd6_0
[conda] pytorch 1.1.0 py3.6_cuda90_cudnn7_1 pytorch
[conda] pytorch-ignite 0.1.0 pypi_0 pypi
[conda] torchvision 0.2.1 pypi_0 pypi

cc @suo

Metadata

Metadata

Assignees

Labels

jit-backlogoncall: jitAdd this issue/PR to JIT oncall triage queuetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions