-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
set_data cannot deal with nodes without owners #5812
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
Comments
Interestingly, I don't get the same error message @lucianopaz ! ShapeError: Resizing dimension 'a' is impossible, because a 'TensorConstant' stores its length. To be able to change the dimension length, pass `mutable=True` when registering the dimension via `model.add_coord`, or define it via a `pm.MutableData` variable. Interestingly, doing: coords = {"a": np.arange(10)}
with pm.Model(coords=coords) as m:
pm.MutableData("x", np.zeros(10), dims="a")
with m:
pm.set_data(
new_data={"x", np.ones(5)},
coords={"a": np.arange(10, 15)}
) raises yet another error message 🤔 TypeError: unhashable type: 'numpy.ndarray' |
@AlexAndorra is right. I wasn't using the latest version on master. I'll update the code to induce the original error again. |
This was last changed in #5763 and I thought we had accounted for all scenarios in the tests. @lucianopaz please check #5817 where I added your scenario as a test case. |
Is this a critical blocker for 4.0? |
The PR that fixes it is ready to merge IMO. |
Description of your problem
set_data
seems to have a problem when the new coordinates are nodes without an owner.Please provide a minimal, self-contained, and reproducible example.
Please provide the full traceback.
Complete error traceback
Please provide any additional information below.
In the traceback,
length_tensor
ism.dim_lengths["a"]
. The type of this variable isaesara.tensor.sharedvar.ScalarSharedVariable
and it has no owners. I don't know when the owner logic was introduced, but it doesn't cover the simple case where the new coordinate is an array. Maybe this was intended? In any case, this should be fixed before releasing v4Original code
Originally, I was running on an older version with respect to main. The code that I used was this
Which now leads to the following traceback instead
I think that it's rather strange not to be able to modify coordinates given via a constant tensor, but to be honest I didn't see when/where it was discussed.
Versions and main components
The text was updated successfully, but these errors were encountered: