Out of place version of tensor.fill_

Relatively simple question, I believe: Due to the structure of my model, I cannot use inplace operations, but I would like to use the fill_ function from torch.Tensor. Is there an out of place variant or similar functionality available? For now I replaced some calls to fill_ with x.fill_(0) with x = torch.zeros(x.size), but some fill_ operations are nested, and so replacing them with an assignment is more cumbersome. Any more convenient alternatives?

You could use torch.full_like instead of the inplace fill_ operation.