You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[torchlib] Register aten::__lshift__ and __rshift__ (#2102)
Tested with
```py
import math
import torch
class Gray(torch.nn.Module):
nbits: int = 32
def forward(self, gray: torch.Tensor):
shifts = [(0x1 << i) for i in range((math.ceil(math.log(self.nbits, 2)) - 1), -1, -1)]
for shift in shifts:
gray ^= gray >> shift
return gray
onnx_program = torch.onnx.export(
Gray(), # model to export
(torch.randint(0, 100, [100], dtype=torch.long)), # inputs of the model,
dynamo=True, # True or False to select the exporter to use,
)
print(onnx_program)
```
Fixespytorch/pytorch#149083
0 commit comments