Avoiding looping when using GP prior on latent variables

Try this:

gamma = gamma_gp.prior(f"gamma_{i}", X=W)
gamma_iw = tt.repeat(gamma[:, None], I, axis=0)

This just adds another dimension and then repeats over that dimension to give you I identical copies of gamma in an array with shape (I, W).

1 Like