Indexing a matrix from a matrix

Hi, I want to execute a task like this in theano.

import theano.tensor as t
import theano 
Z = t.matrix("Z")
Phi = t.matrix("Phi")
result = Phi[Z]
compute = theano.function(inputs = [Z,Phi], output = result)
print(compute(z,phi)) 

But i get error:

ValueError: Cannot compute test value: input 0 (Z) of Op Shape(Z) missing default value.
Backtrace when that variable is created.

Can anyone point me where I am going wrong?
Thanks in advance.

@junpenglao Can you help me with this?
Thanks

You can set the compute_test_value property in theano to suppress the error:

theano.config.compute_test_value='off'
Z = t.lmatrix("Z")
Phi = t.matrix("Phi")
result = Phi[Z]
compute = theano.function(inputs=[Z, Phi], outputs=[result])
phi = np.random.randn(2,1)
z = np.random.choice([0, 1], size=(10, 10))
print(compute(z, phi))