Hi, if you new to PyMC, it may be better to use PyMC v4 with Aesara. The new PyMC version can handle shape better, and there are a lot of improvement in Aesara compared to Theano.
For the shape handling in PyMC3, you can check this notebook: gp_regression/spawning_salmon.ipynb at master · fonnesbeck/gp_regression · GitHub
I converted the above notebook into PyMC v4 here: gp_experiments/gp_salmon_pymc_v4.ipynb at main · danhphan/gp_experiments · GitHub
For your exmaple, in this line of codes:
y1 = gp.marginal_likelihood("y1",
X=theta_all.reshape(-1,1),
y=f_all.reshape(-1,1),
noise=s_n)
Maybe X should be shape (n,1) while y should be shape (n,) but not (n,1).