1# mypy: allow-untyped-defs 2import torch 3 4 5class TensorSetattr(torch.nn.Module): 6 """ 7 setattr() call onto tensors is not supported. 8 """ 9 def forward(self, x, attr): 10 setattr(x, attr, torch.randn(3, 2)) 11 return x + 4 12 13example_args = (torch.randn(3, 2), "attr") 14tags = {"python.builtin"} 15model = TensorSetattr() 16