new_tensor = new_tensor.to(input.device)
will change new tensor to be cuda if needed.

This creates very ugly (and slow) code such as
    if std.is_cuda:
        eps = torch.FloatTensor(std.size()).cuda().normal_()
    else:
        eps = torch.FloatTensor(std.size()).normal_()

instead of the much better
eps = std.new().normal_()
Isn’t there a better way?