-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
Description
Describe the issue:
pytensor.tensor.cartesian does not work on TensorVariables
Reproduceable code example:
a = pm.Normal("a", shape=(7,))
b = pm.Normal("b", shape=(2,7))
pm.math.cartesian(a, b).shape.eval()
# Throws an error
# I need [7,2,7]
pytensor.tensor.mul(a,b).shape()
# [2,7] <- not what I needError message:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/anaconda3/envs/dev_refactor_2/lib/python3.12/site-packages/pymc/math.py", line 214, in cartesian
arrays_integer = [np.arange(len(x)) for x in arrays_2d]
^^^^^^
TypeError: len() of unsized objectPyMC version information:
5.19.1 conda
Context for the issue:
I don't know if there is another way to do this, but I have two TensorVariables with possibly matching dimension lengths, and I need the cartesian product of them. I can't seem to find a way to let the matching dimensions be combined.