To say the conclusion first, I want to check shape of variable 'X' that is 'sequences' parameter in theano.tensor.scan function
scan function looks like this : def forward(self, X): """ X.shape = (timesteps, dim) X.shape = (n_samples, timesteps, dim) """ print('X shape: ', X.shape) states, updates = theano.scan( fn=self.step, sequences=[X], outputs_info=[self.h_tm1, self.c_tm1], non_sequences=[ self.Ui, self.Wi, self.bi, self.Uf, self.Wf, self.bf, self.Uo, self.Wo, self.bo, self.Ug, self.Wg, self.bg ] ) print('scan end') updates = [(self.h_tm1, states[0][-1]), (self.c_tm1, states[1][-1])] return states, updates ___________________________________ and step function looks like this : def step( x_t, h_tm1, c_tm1, Ui, Wi, bi, Uf, Wf, bf, Uo, Wo, bo, Ug, Wg, bg ): print('x_t.shape : ', x_t.shape) """ x_t.shape = (timestep=1, dim) x_t.shape = (n_samples, timestep=1, dim) """ i_t = T.nnet.sigmoid(T.dot(x_t, Ui) + T.dot(h_tm1, Wi) + bi) f_t = T.nnet.sigmoid(T.dot(x_t, Uf)+T.dot(h_tm1, Wf)+bf) o_t = T.nnet.sigmoid(T.dot(x_t, Uo) + T.dot(h_tm1, Wo) + bo) g_t = T.tanh(T.dot(x_t, Ug) + T.dot(h_tm1, Wg) + bg) c_t = c_tm1 * f_t + g_t * i_t h_t = T.tanh(c_t) * o_t return h_t, c_t The problem is that X.shape is maybe (26,10,7002). But this is just my assumption (I don't know how to check it ). and x_t is maybe (10,7002). But error occured when compute 'f_t = T.nnet.sigmoid(T.dot(x_t, Uf)+T.dot(h_tm1, Wf)+bf)' . Maybe because of shape mismatch about elem_wise Once theano.function is begin, it is hard to check shape of numpy array(or tensorVariable?). I coded ' print('x_t.shape : ', x_t.shape) in start line of step function. But it didn't work. Some people say you should use 'printing.Print function'. But specifically want to method writing the code. Thank you for reading this question. Truly grateful. -- --- You received this message because you are subscribed to the Google Groups "theano-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.