Open AlanLu0808 opened 3 years ago
Because pytorch grid sample is written in C++ and I think also it was using multi-threading. I have changed their C++ code and build only zero padding for grid sample. Below is the binary file.
https://drive.google.com/file/d/1kzUKuKMZyoHA_aFT0T2oMwvw8B2BYc3C/view?usp=sharing
You can load this binary file and use it with torch library:
import torch torch.ops.load_library("my_grid_sampler.cpython-36m-x86_64-linux-gnu.so")
torch.ops.mynamespace.my_grid_sampler(image, grid)
Thank you for your work!When I use your c++ binary,an error will be reported as:
Segmentation fault (core dumped)
And my calling method is as follows(in first-order-model):
import torch torch.ops.load_library("my_grid_sampler.cpython-36m-x86_64-linux-gnu.so")
#sparse_deformed = F.grid_sample(source_repeat, sparse_motions)
sparse_deformed = torch.ops.mynamespace.my_grid_sampler(source_repeat, sparse_motions)
Thank you!
I found the grid sample in pytorch is very fast. Maybe the opearation can be done in 1ms. In contrast, this one is quiet slow, costing several mintes! Any suggestions? Tks!