Search code examples
pythondebuggingopencvtheano

How can I plot theano.tensor value?


To visualize TensorType(float64, matrix) as an image using imshow, How could I that?I cannot directly use imshow on Tensor since it gives me this error

mat is not a numpy array, neither a scalar

When I try to convert datatype to array using numpy.asarray I get

 mat data type = 17 is not supported

Is there any way to convert to uint8 datatype?


Solution

  • Theano tensors are symbolic variables, with no value attached to them. If you want to plot something it is probably a shared variable (the weights of your network), in which case you can grab the values with my_shared.get_value(), or the output of the network when you pass an input, in which case I believe it should already be a numpy array.