You can rely on numpy broadcasting semantics:
import numpy as np
x = np.zeros(120)
y = np.zeros(5)
z1 = x[:, None] + y
z2 = x + y[:, None]
assert z1.shape == (120, 5)
assert z2.shape == (5, 120)
Works the same with PyMC variables
You can rely on numpy broadcasting semantics:
import numpy as np
x = np.zeros(120)
y = np.zeros(5)
z1 = x[:, None] + y
z2 = x + y[:, None]
assert z1.shape == (120, 5)
assert z2.shape == (5, 120)
Works the same with PyMC variables