torch.compiler.wrap_numpy
- torch.compiler.wrap_numpy(fn)
Decorator that turns a function from
np.ndarrays tonp.ndarrays into a function fromtorch.Tensors totorch.Tensors.It is designed to be used with with . It allows you to compile a NumPy function as if it were a PyTorch function. This allows you to run NumPy code on CUDA or compute its gradients.