I’m trying to code up a module from jit.ScriptModule that looks like this:
class Model(jit.ScriptModule): def __init__(self, size): super().__init__() self.rnn = nn.GRUCell(size, size) @jit.script_method def forward(self, hidden, inputs): something = [torch.empty(0)] * 10 return self.rnn(inputs, hidden)
however, it triggers the following errors:
arguments for call are not valid:
for operator aten::mul(Tensor self, Tensor other) -> Tensor:
expected a value of type Tensor for argument ‘self’ but found Tensor
I found the reason is that list comp is not available it jit, is there any fix?