I am using Deep learning Theano. How can I see the content of a variable like this: Elemwise{tanh,no_inplace}.0
. It is the input data of logistic layer.
2 Answers
Right now, you don't seem to print values but operations. The output Elemwise{tanh,no_inplace}.0
means, that you have an element wise operation of tanh, that is not done in place. You still need to create a function that takes input and executes your operation. Then you need to call that function and print the result. You can read more about that in the graph-structure part of their tutorial.

- 133
- 1
- 7
Suppose your variable is called t
. Then you can evaluate it by calling t.eval()
. This may fail if input data are needed. In that case you need to supply them by providing a dictionary like this t.eval({input_var1: value1, input_var2: value2})
. This is the ad-hoc way of evaluating a theano-expression.
The way it works in real programs is to create a function taking the necessary input, for example: f = theano.function([input_var1, input_var2], t)
, will yield a function that takes two input variables, calculates t
from them and outputs the result.

- 14,152
- 1
- 48
- 52
-
I cannot get the result. Let me ask in another way; how can I save the intermediate features, I mean `layer2.output`. I want to import them into weka software to further analysis. – mar Sep 15 '15 at 23:09
-
1You will have to provide a very small example code that can be run by anyone reading this question. Generate some random data, make a very small model, and then show us where it doesn't work. Why did you accept the answer if it hasn't worked for you yet? What is the actual error message? – eickenberg Sep 16 '15 at 04:46
-
There are two library regarding deep leaning based on Theano in the net. (1) [DeepLearningToturial] (https://github.com/lisa-lab/DeepLearningTutorials/blob/master/code/convolutional_mlp.py), and (2) is [Theano-Totorials-Master] (https://github.com/Newmu/Theano-Tutorials/blob/master/5_convolutional_net.py). I could got the your point via (2), but I have difficulty with (1). I thing it is because the input of (1) is **index**, and I could not overcome it yet. – mar Sep 16 '15 at 05:41
-
Well, if you know the sample numbers and store them in `sample_numbers`, then you can eval with `{index: sample_numbers}` – eickenberg Sep 16 '15 at 07:25