how we can get the shape of variables?? در جمعه 30 اکتبر 2015، ساعت 0:08:38 (UTC+3:30)، [email protected] نوشته: > > Thanks a lot!. It works now. Thank you! > > On Thursday, October 29, 2015 at 12:52:40 PM UTC-7, Daniel Renshaw wrote: >> >> The position is important. It needs to be like this: >> >> def one_lstm_step(x_t, h_tm1, c_tm1, >> W_xi, W_hi, W_xf, W_hf, W_xc, W_hc, W_xo, >> W_ho): >> i_t = T.nnet.sigmoid(theano.dot(x_t, W_xi) + >> theano.dot(h_tm1, W_hi)) >> f_t = T.nnet.sigmoid(theano.dot(x_t, W_xf) + >> theano.dot(h_tm1, W_hf)) >> c_t = f_t * c_tm1 + i_t * T.tanh(theano.dot(x_t, W_xc) + >> theano.dot(h_tm1, W_hc) ) >> c_t = theano.printing.Print('c_t')(c_t) >> o_t = T.nnet.sigmoid(theano.dot(x_t, W_xo)+ theano.dot(h_tm1, >> W_ho)) >> h_t = o_t * T.tanh(c_t) >> return [h_t, c_t] >> >> So after c_t is first defined but before c_t is then used. >> >> On 29 October 2015 at 19:35, <[email protected]> wrote: >> >>> Thanks, Daniel, >>> I added the line c_t = theano.printing.Print('c_t')(c_t) in the step >>> function, but it didn't print out anything. There was no compile error, but >>> it didn't print out anything. >>> >>> On Thursday, October 29, 2015 at 11:32:59 AM UTC-7, Daniel Renshaw wrote: >>>> >>>> You can use the theano.printing.Print operation. >>>> >>>> For example, add the line >>>> >>>> c_t = theano.printing.Print('c_t')(c_t) >>>> >>>> after the line that sets the value for c_t in your existing step >>>> function. >>>> >>>> Daniel >>>> >>>> >>>> On 29 October 2015 at 18:27, <[email protected]> wrote: >>>> >>>>> Hello, >>>>> >>>>> I would like to know how to print variable inside the scan function. >>>>> >>>>> For example, in lstm code, I would like to printout "c_t" for each >>>>> step. >>>>> >>>>> def one_lstm_step(x_t, h_tm1, c_tm1, >>>>> >>>>> W_xi, W_hi, W_xf, W_hf, W_xc, W_hc, W_xo, >>>>> W_ho): >>>>> >>>>> >>>>> i_t = T.nnet.sigmoid(theano.dot(x_t, W_xi) + >>>>> theano.dot(h_tm1, W_hi)) >>>>> >>>>> f_t = T.nnet.sigmoid(theano.dot(x_t, W_xf) + >>>>> theano.dot(h_tm1, W_hf)) >>>>> >>>>> c_t = f_t * c_tm1 + i_t * T.tanh(theano.dot(x_t, W_xc) + >>>>> theano.dot(h_tm1, W_hc) ) >>>>> >>>>> o_t = T.nnet.sigmoid(theano.dot(x_t, W_xo)+ >>>>> theano.dot(h_tm1, W_ho)) >>>>> >>>>> h_t = o_t * T.tanh(c_t) >>>>> >>>>> return [h_t, c_t] >>>>> >>>>> [self.h_vals, _, _, _], _ = theano.scan(fn=one_lstm_step, >>>>> sequences=self.input, >>>>> >>>>> outputs_info=[self.h0, self.c0, self.a0_1, >>>>> self.a0_2], >>>>> >>>>> non_sequences=[self.W_xi, self.W_hi, >>>>> >>>>> self.W_xf, self.W_hf, >>>>> >>>>> self.W_xc, self.W_hc, >>>>> >>>>> self.W_xo, self.W_ho], >>>>> >>>>> n_steps=self.n_steps, strict=True, allow_gc=False) >>>>> >>>>> >>>>> Thank you. >>>>> >>>>> -- >>>>> >>>>> --- >>>>> 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 [email protected]. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>> >>> --- >>> 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 [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >>
-- --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
