If the other function just uses operations which are supported on the GPU, you won’t have to push the tensor to CPU.
What is your function doing? If you are using PyTorch functions inside, it should all work without any device-to-host transfer.