-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Closed
Labels
oncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queue
Description
🐛 Bug
[JIT] Cannot index into tuple with non constant integer. Constant array turns it the array into tuple
To Reproduce
import torch
class Normalize(torch.jit.ScriptModule):
__constants__ = ['mean', 'std']
def __init__(self):
super(Normalize, self).__init__()
self.mean = [1, 1, 1]
self.std = [1, 1, 1]
@torch.jit.script_method
def forward(self, image):
# type: (torch.Tensor) -> torch.Tensor
for i in range(3):
image[:, i] = image[:, i].sub_(self.mean[i]).div_(self. std[i])
return image
Normalize()
tuple indices must be integer constants:
@torch.jit.script_method
def forward(self, image):
# type: (torch.Tensor) -> torch.Tensor
for i in range(3):
image[:, i] = image[:, i].sub_(self.mean[i]).div_(self.std[i])
~~~~~~~~~~~ <--- HERE
return image
Metadata
Metadata
Assignees
Labels
oncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queue