What is the effect of torch.new?

for example,
a = torch.ones(3,3)
b = a.new()
so, is there any relationship between a and b? or just they are same data type? for example float or int?

3 Likes

yeah, i found it
https://pytorch-cn.readthedocs.io/zh/latest/package_references/Tensor/#newargs-kwargs

1 Like

For Pytorch 0.4 we’d recomend the tensor.new_* functions over the legacy tensor.new(...). See https://pytorch.org/docs/master/tensors.html#torch.Tensor.new_tensor for more details.

3 Likes

yeah, thank u very much