-
Notifications
You must be signed in to change notification settings - Fork 41
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
sample_points()
error when sampling from a composite domain
#29
Comments
Hey, How did you install TorchPhysics? With With
And if you run this cell:
The sampling appears to work correctly. |
Thanks for the fast reply. It can be indeed due to a mismatch of PyTorch versions. My PyTorch version is 2.0.1, and I installed torchphysics from GitHub with It works in the colab as you've suggested, with the following crucial ouput:
Why do you specify
it also hits that requirement
in colab gives this full output (make sure that colab doesn't have older version torch preinstalled from your previous commands, i.e. have a clean runtime) Full output
I prefer to use the latest torch, at least because I rely on torchvision transformations. Perhaps it would help me to understand what exactly |
We are mainly developing the library in our fork of TorchPhysics, so the version on the boschresearch page is not always up-to-date. Since we don't have access to merge the code here. I'm sorry for this inconvenience. Because of this, the Regarding Google Colab: By default, the newest version of PyTorch and the subpackages are installed. But TorchPhysics may not yet be (or rather is not) compatible with the version >=2.0.0 (both of PyTorch and PyTroch-Lightning). Generally, I am not sure if I think updating TorchPhysics to run with versions 2.0.0 and newer will take some effort and time. We may focus on this in the next weeks, but until then, I recommend sticking with PyTorch version < 2.0 (if possible). |
Thanks for the nice library! I was writing a similar code to solve my inverse problem with PINNs when I stumbled upon your project, and decided to try using it, since it has nice sampling, domain creation, and conditions logic. However, I encounter a problem in a simple situation when I try to obtain points from a 2d domain which is a
CutDomain
:This gives the assertion error in
__torch_function__
:assert len(spaces) > 0
, asserted here.Expected behavior:
Have 100 points from domain
O
, which is a subtraction ofA
fromR
.Observed behavior:
sample_points()
call runssample_domain_uniform()
and inside_random_points_inside()
when there should be a check of what points belong to the region, there is a eventually a linetorch.repeat_interleave(params, n, dim=0)
, which fails forparams = Points.empty()
I would try to fix this issue myself, but I cannot understand the point of the function
_repeat_params
, and of the assertion. Perhaps you can help clarifying the issue of what the code tries to check and why? Then I'd be able to write up a working version of the code for the case of 2d regions.Also, I stumbled somewhere that it might be not supported to sample from domains like that? Is that so?
The text was updated successfully, but these errors were encountered: