I've been trying to debug some Theano code, for which I used Keras as a front end. What I've been doing is inserting either:
import pdb
pdb.set_trace()
or
import code
code.interact(local=locals(), banner='==>")
at the point where I want to begin interacting with my code to see what's going on and interactively test solutions. But, when I use pdb to interact with my code, I see this odd behaviour:
--Return--
> /home/me/Projects/keras_expts2/cifar10_cnn_ecoc2a.py(174)<module>()->None
-> pdb.set_trace()
(Pdb) import theano.tensor as T
(Pdb) a=T.fvector()
(Pdb) type(a)
*** NameError: name 'a' is not defined
(Pdb) T
<module 'theano.tensor' from '/home/smgutstein/Downloads/Theano/theano/tensor/__init__.pyc'>
(Pdb) T.fvector
TensorType(float32, vector)
So, pdb knows what T and fvector are, it just won't create a Theano fvector variable.
However, using code, I see this (better) behaviour:
==>
>>> import theano.tensor as T
>>> a = T.fvector()
>>> type(a)
<class 'theano.tensor.var.TensorVariable'>
>>> T.fvector
TensorType(float32, vector)
>>>
Why is there this difference?