How can I print the numerical value of a theano TensorVariable? I\'m new to theano, so please be patient :)
I have a function where I get y
For future readers: the previous answer is quite good. But, I found the 'tag.test_value' mechanism more beneficial for debugging purposes (see theano-debug-faq):
from theano import config
from theano import tensor as T
config.compute_test_value = 'raise'
import numpy as np
#define a variable, and use the 'tag.test_value' option:
x = T.matrix('x')
x.tag.test_value = np.random.randint(100,size=(5,5))
#define how y is dependent on x:
y = x*x
#define how some other value (here 'errorCount') depends on y:
errorCount = T.sum(y)
#print the tag.test_value result for debug purposes!
errorCount.tag.test_value
For me, this is much more helpful; e.g., checking correct dimensions etc.