Open adsharma opened 3 months ago
b = torch.zeros_like(a)
should be preferred over
b = torch.zeros(...).to(a)
to avoid copies.
Agree. It might be problematic to figure out statically when a in .to(a) is a tensor, and not a dtype or device. Do you have any real-world examples?
a
.to(a)
https://github.com/threestudio-project/threestudio/blob/main/threestudio/models/background/solid_color_background.py#L37-L39
should be preferred over
to avoid copies.