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

Type mismatch #5

Open
brisvag opened this issue Aug 8, 2024 · 3 comments
Open

Type mismatch #5

brisvag opened this issue Aug 8, 2024 · 3 comments

Comments

@brisvag
Copy link

brisvag commented Aug 8, 2024

Tried to run the "example" in projection_backprojection_cycle.py.

After adjusting it to make it run on some local data, I get the following error:

  File "/home/brisvag/git/teamtomo/torch-fourier-slice/src/torch_fourier_slice/slice_insertion/_insert_central_slices_rfft_3d.py", line 73, in insert_central_slices_rfft_3d
    dft_3d, weights = insert_into_image_3d(
                      ^^^^^^^^^^^^^^^^^^^^^
  File "/home/brisvag/venv/torch-fourier-slice/lib/python3.12/site-packages/torch_image_lerp/linear_interpolation_3d.py", line 140, in insert_into_image_3d
    add_data_at_corner(0, 0, 0)
  File "/home/brisvag/venv/torch-fourier-slice/lib/python3.12/site-packages/torch_image_lerp/linear_interpolation_3d.py", line 137, in add_data_at_corner
    weights.index_put_(indices=(zc, yc, xc), values=w, accumulate=True)
RuntimeError: Index put requires the source and destination dtypes match, got Double for the destination and ComplexDouble for the source.

I'm not sure I get where the problem needs to be fixed.

@alisterburt
Copy link
Member

Hehe, ugh - this one is super annoying and I'm also not sure where is the best place to fix it

I think all tensors generated inside the function should be made compatible with the input tensor. The reason I'm not 100% here is that precision is important when accumulating so originally I was forcing the accumulation to happen in float64...

@alisterburt
Copy link
Member

Oh wait, this seems different - weights should be real valued, I must have cast to complex in an effort to fix the issue I described above...

@alisterburt
Copy link
Member

c.f. #6 for the start of fixing this

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

2 participants