implementing theano classes