I’m trying to use Aesara matmul but am having an issue due to the shape of some dimensions being None.
For example:
import numpy as np
import pymc as pm
import aesara.tensor as at
from aesara.tensor.basic import as_tensor_variable
a = np.random.random(size=(10, 5, 3))
b = np.random.random(size=(10, 3, 1))
# Works fine, prints (10, 5, 1)
print(at.matmul(a, b).eval().shape)
# This gives an error
# TypeError: 'NoneType' object cannot be interpreted as an integer
with pm.Model() as m:
c = pm.Normal('c', shape=(10, 3, 1))
at.matmul(a, c)
# TensorType(float64, (10, 5, 3))
print(as_tensor_variable(a).type)
# TensorType(float64, (None, None, 1))
print(c.type)
The issue seems to be with the shapes being None during broadcasting.
Any advise on the correct usage of aesara matmul would be appreciated, thanks!