The answer given by @Bob only returns the imaginary part of the transform. If you'd like to return a complex number (more similar to the scipy hilbert function), you can return a complex tensor like so.
def hilbert_transform(data):
# Allocates memory on GPU with size/dimensions of signal
data = torch.from_numpy(data).to('cuda')
transforms = -1j * torch.fft.rfft(data, axis=-1)
transforms[0] = 0;
imaginary = torch.fft.irfft(transforms, axis=-1)
real = data
return torch.complex(real, imaginary)
This will play nicely with functions like torch.angle to get signal phase and torch.abs to get the envelope using both real and imaginary components.