I have a code that looks like this
import torch as tc
from torch import jit
@jit.script
def func(inp):
return inp<<1
a = tc.tensor([3,4,5])
func(a)
when I run it, I got the error:
torch.jit.frontend.NotSupportedError: unsupported binary operator: LShift:
File "example.py", line 5
@jit.script
def func(inp):
return inp<<1
~~ <--- HERE
However, if I change inp<<1
to inp.__lshift__(1)
, it works. This also happens in C++. Is there a reason behind this or is it just that support for binary operators are not fully implemented yet? I’m using Pytorch 1.4.0 on windows with the corresponding version of libtorch.
Thanks.