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

[BUG] function only supports 2D spatial inputs, received 70283598 #60

Closed
ramonemiliani93 opened this issue Jul 29, 2024 · 3 comments
Closed

Comments

@ramonemiliani93
Copy link

ramonemiliani93 commented Jul 29, 2024

Hi 👋

First, I want to thank you for the amazing library 🙌. I'm encountering an issue while trying to run a simple example, and I would greatly appreciate any help or guidance you can provide.

Describe the bug
There is an error on PyTorch==2.2.2 when running the signed_generalised_geodesic3d method.

To Reproduce
Steps to reproduce the behavior:

  1. pyenv local 3.10
  2. python -m venv .venv
  3. source .venv/bin/activate
  4. pip install "torch==xxx" FastGeodis
  5. Run the following script:
import torch, FastGeodis
image = torch.ones((1, 1, 9, 9, 9))
mask = torch.ones((1, 1, 9, 9, 9))
mask[0, 0, 4, 4, 4] = 0
FastGeodis.signed_generalised_geodesic3d(image, mask, [1.0, 1.0, 1.0], 1e10, 0.0, 4)

Expected behavior
The method should compute the signed map and not raise ValueError: function only supports 2D spatial inputs, received <number>. From the torch versions I tried (all with python 3.10):

  • torch==2.4.0
  • torch==2.3.1
  • torch==2.2.2ValueError: function only supports 2D spatial inputs, received 69578766
  • torch==2.1.2ImportError: dlopen(/Users/ramon/afxmedical/fastgeodis-bug/.venv/lib/python3.10/site-packages/FastGeodisCpp.cpython-310-darwin.so, 0x0002): Symbol not found: __ZN2at4_ops10empty_like4callERKNS_6TensorENSt3__18optionalIN3c1010ScalarTypeEEENS6_INS7_6LayoutEEENS6_INS7_6DeviceEEENS6_IbEENS6_INS7_12MemoryFormatEEE Referenced from: <F61DC557-D8F2-383F-AF8E-372C708E3C08>
  • torch==2.0.1ImportError: dlopen(/Users/ramon/afxmedical/fastgeodis-bug/.venv/lib/python3.10/site-packages/FastGeodisCpp.cpython-310-darwin.so, 0x0002): Symbol not found: __ZN2at4_ops10empty_like4callERKNS_6TensorENSt3__18optionalIN3c1010ScalarTypeEEENS6_INS7_6LayoutEEENS6_INS7_6DeviceEEENS6_IbEENS6_INS7_12MemoryFormatEEE Referenced from: <F61DC557-D8F2-383F-AF8E-372C708E3C08>

Desktop (please complete the following information):

  • OS: macOS
  • Version: 14.5
@masadcv
Copy link
Owner

masadcv commented Aug 2, 2024

Hi @ramonemiliani93,

Thanks for reporting this. It is indeed a very odd behaviour.
From the example and macOS, I can infer that this error is coming from CPU execution (i.e. both your tensors are on cpu device), is this correct?

Did you try the unsigned geodesic functions directly? It may help debug further if you try those as well because signed distance is calling those functions internally...

Also please indicate you gcc/g++ or related compiler version that you are using for installation

@masadcv
Copy link
Owner

masadcv commented Aug 2, 2024

Hi @ramonemiliani93

I have looked into this with the same OS, Python and Pytorch versions that you mentioned failing here.
It seems like in your case there is some conflict between what is used for compiling the library (often referred to as build dependency) and what you have installed in the virtualenv. This is related to issue report here: #6 (comment)

Can you try the following:

pip install FastGeodis --no-build-isolation --no-cache-dir

This should resolve the issue you are seeing. Please do let me know if it doesnt.

@ramonemiliani93
Copy link
Author

Hi @masadcv! Thanks a lot! This has solved the issue 💪 Tried it with torch 2.2.2 and it works 🙌

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