torchfix
torchfix copied to clipboard
Use torch.*_like()
b = torch.zeros_like(a)
should be preferred over
b = torch.zeros(...).to(a)
to avoid copies.