Latent GP prior on X=theano.shared node with changing shape

I’d like to use the X coordinates for the Latent GP as a changing theano.shared node. Something like

X = theano.shared(X_init)
gp = pm.gp.Latent(cov_func=cov)
J = gp.prior('J', X, shape=???)

# before inference
X.set_value(X_new)  # possibly new shape

Apparenty I have to specify a shape parameter, because it cannot be inferred from the X TheanoVariable. However, I’d like to change the X node later (for each frame to be reconstructed). Is something like this possible? Or will I have to create a new prior for each new X? I’m trying to prevent a constant redefinition of the model for each input.

I dont think it is possible (see a small related discussion here https://github.com/pymc-devs/pymc3/issues/2406).
It is better to define a separate GP for each frame in your case, especially if the input shape is different. If the shape is the same you can try the newly implemented pm.MatrixNormal (http://docs.pymc.io/api/distributions/multivariate.html#pymc3.distributions.multivariate.MatrixNormal)

And if I were to relax my wish to use arbitrary shapes? Is it possible to just change the values of shared X ?