Thank you for your reply.
I also ran my code on CUDA 11 GPU on google colaboratory, but I had a problem about GPU.
!nvcc --version
!git clone https://github.com/google-research/fast-soft-sort/
import os
path = './fast-soft-sort'
os.chdir(path)
import torch
from fast_soft_sort.pytorch_ops import soft_rank, soft_sort
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
print(device)
values = torch.tensor([[5., 1., 2.], [2., 1., 5.]], dtype=torch.float64).to(device)
soft_sort(values, regularization_strength=1.0)
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Wed_Jul_22_19:09:09_PDT_2020
Cuda compilation tools, release 11.0, V11.0.221
Build cuda_11.0_bu.TC445_37.28845127_0
Cloning into 'fast-soft-sort'...
remote: Enumerating objects: 76, done.
remote: Counting objects: 100% (76/76), done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 76 (delta 44), reused 64 (delta 33), pack-reused 0
Unpacking objects: 100% (76/76), done.
cuda:0
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-9-d7a59b351a2b> in <module>()
12 print(device)
13 values = torch.tensor([[5., 1., 2.], [2., 1., 5.]], dtype=torch.float64).to(device)
---> 14 soft_sort(values, regularization_strength=1.0)
3 frames
/content/fast-soft-sort/fast_soft_sort/pytorch_ops.py in forward(ctx, values)
32 @staticmethod
33 def forward(ctx, values):
---> 34 obj = cls(values.detach().numpy(), **kwargs)
35 ctx.numpy_obj = obj
36 return torch.from_numpy(obj.compute())
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.