Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inference too slow #1

Open
AlanLu0808 opened this issue Jan 12, 2021 · 2 comments
Open

Inference too slow #1

AlanLu0808 opened this issue Jan 12, 2021 · 2 comments

Comments

@AlanLu0808
Copy link

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!

@OrkhanHI
Copy link
Owner

OrkhanHI commented Jan 12, 2021

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")
#Call the function
torch.ops.mynamespace.my_grid_sampler(image, grid)

@zhangziwenHIT
Copy link

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")
#Call the function
#sparse_deformed = F.grid_sample(source_repeat, sparse_motions)
sparse_deformed = torch.ops.mynamespace.my_grid_sampler(source_repeat, sparse_motions)
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants