Comments (3)
Sorry that I didn't catch this (I didn't test it ...), and thank you for sharing your findings!
from pytorch-spynet.
Thank you for your kind words! The location of the code doesn't matter much. I see it more as a utility function which is why I prefer it to be separate from the model. Regarding your error message, try changing the backward warping to the following.
def backwarp(tenInput, tenFlow):
if str(tenFlow.shape) not in backwarp_tenGrid:
tenHor = torch.linspace(-1.0 + (1.0 / tenFlow.shape[3]), 1.0 - (1.0 / tenFlow.shape[3]), tenFlow.shape[3]).view(1, 1, 1, -1).expand(-1, -1, tenFlow.shape[2], -1)
tenVer = torch.linspace(-1.0 + (1.0 / tenFlow.shape[2]), 1.0 - (1.0 / tenFlow.shape[2]), tenFlow.shape[2]).view(1, 1, -1, 1).expand(-1, -1, -1, tenFlow.shape[3])
backwarp_tenGrid[str(tenFlow.shape)] = torch.cat([ tenHor, tenVer ], 1)
# end
tenFlow = torch.cat([ tenFlow[:, 0:1, :, :] / ((tenInput.shape[3] - 1.0) / 2.0), tenFlow[:, 1:2, :, :] / ((tenInput.shape[2] - 1.0) / 2.0) ], 1)
return torch.nn.functional.grid_sample(input=tenInput, grid=(backwarp_tenGrid[str(tenFlow.shape)].cuda() + tenFlow).permute(0, 2, 3, 1), mode='bilinear', padding_mode='border', align_corners=False)
# end
Closing for now since this should do the trick. I am happy to reopen this issue if it still persists though, just let me know.
from pytorch-spynet.
Thanks for your responce.
actually, by using .cuda()
was pusing the tensor on to default GPU, and other tensors were on different GPUs. the solution for that is pushing all the tensors on the same GPU by specifying GPU device. .cuda(tenFlow.device)
return torch.nn.functional.grid_sample(input=tenInput, grid=(backwarp_tenGrid[str(tenFlow.shape)].cuda(tenFlow.device) + tenFlow).permute(0, 2, 3, 1), mode='bilinear', padding_mode='border', align_corners=False)
from pytorch-spynet.
Related Issues (20)
- Hello! How to solve this problem? HOT 1
- pre_trained model HOT 3
- RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED HOT 3
- TypeError: grid_sample() got an unexpected keyword argument 'align_corners' HOT 4
- Could you please provide the training scripts? HOT 1
- From first image to the second HOT 1
- Reimplementation in Tensorflow HOT 1
- backwarp function HOT 1
- Question about code HOT 1
- error in demo HOT 2
- How to train spynet using pytorch? HOT 4
- getopt error HOT 1
- Invalid arguments in run.py in line 151. HOT 2
- Training Architecture HOT 1
- Error when running the command HOT 10
- How to open the .flo output file? HOT 1
- Is there a training function that goes with this? HOT 1
- Can you provide me your flow rendering code? HOT 2
- PIL and pytorch are in conflict HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch-spynet.