how to use dot production on batch data?
This expression should do the trick:

theano.tensor.tanh((x * y).sum(2))

The dot product is computed 'manually' by doing element-wise multiplication, then summing over the last dimension.
I am trying to apply tanh(dot(x,y));
x and y are batch data of my RNN.  
x,y have shape (n_batch, n_length, n_dim) like (2,3,4) ; 2 samples with 3 sequences, each is 4 dimensions.
I want to do inner or dot production to last dimension.  Then tanh(dot(x,y)) should have shape of (n_batch, n_length) = (2, 3)
Which function should I use?