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

GridSamplingOp on dynamics #513

Open
guastinimara opened this issue Nov 12, 2024 · 1 comment
Open

GridSamplingOp on dynamics #513

guastinimara opened this issue Nov 12, 2024 · 1 comment

Comments

@guastinimara
Copy link
Collaborator

I had problems using the GridSamplingOp on image dynamics, in particular on images in the shape of (other 1 1 y x) with grids of shape (other y x 2), where in other I had the different timesteps, so other was bigger than 1 both for the images and for the grids (and it was the same value)

the error came from the GridSamplingOp rearrange:
x_real = rearrange(torch.view_as_real(x), '... real_imag -> real_imag ...') if x.is_complex() else x
which led to a broadcasting error

For what I need it for, I used it just by changing it into
x_real = rearrange(torch.view_as_real(x), ' other ... real_imag -> other real_imag ... ') if x.is_complex() else x
and
result = torch.view_as_complex(rearrange(result, 'other real_imag ... -> other ... real_imag').contiguous())

This worked for me, but it would work only if either other is the same for images and grids, or one of them is equal to one, so maybe there is a better way to generalize this

@guastinimara
Copy link
Collaborator Author

Like for example if the other dimension in the images is a multiple of that in the grids, this doesn't work

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

1 participant