(self, inputs, inference=False, beta=0.0)
return x
Forward propagation for sequence to sequence container. Calls
        fprop for the Encoder container followed by fprop for the Decoder
        container. If inference is True, the Decoder will be called with
        individual time steps in a for loop.
Forward propagation for sequence to sequence container. Calls
        fprop for the Encoder container followed by fprop for the Decoder
        container. If inference is True, the Decoder will be called with
        individual time steps in a for loop.
Forward propagation for sequence to sequence container . Calls fprop for the Encoder container followed by fprop for the Decoder container . If inference is True the Decoder will be called with individual time steps in a for loop .
def fprop(self, inputs, inference=False, beta=0.0):
        """
        Forward propagation for sequence to sequence container. Calls
        fprop for the Encoder container followed by fprop for the Decoder
        container. If inference is True, the Decoder will be called with
        individual time steps in a for loop.
        """
        # make sure we are in the correct decoder mode
        self.decoder.switch_mode(inference)

        if not inference:
            # load data
            (x, z) = inputs

            # fprop through Encoder layers
            x = self.encoder.fprop(x, inference=inference, beta=0.0)

            # get encoder hidden state
            init_state_list = self.encoder.get_final_states(self.decoder_connections)

            # fprop through Decoder layers
            x = self.decoder.fprop(z, inference=inference, init_state_list=init_state_list)
        else:  # Loopy inference

            # prep data
            x = inputs
            new_steps = 1
            if self.hasLUT:
                z_shape = new_steps
            else:
                z_shape = (self.out_shape[0], new_steps)
            z = x.backend.iobuf(z_shape)

            # encoder
            x = self.encoder.fprop(x, inference=inference, beta=0.0)

            # get encoder hidden state
            init_state_list = self.encoder.get_final_states(self.decoder_connections)

            # decoder
            steps = self.in_shape[1]
            if self.hasLUT:
                z_argmax = x.backend.zeros((1, z.shape[0]*z.shape[1]))

            for t in range(steps):
                z = self.decoder.fprop(z, inference=inference, init_state_list=init_state_list)

                # transfer hidden state from DECODER to next step
                init_state_list = [recurrent.final_state()
                                   for recurrent in self.decoder._recurrent]

                # and write to output buffer
                self.xbuf[:, t*self.be.bsz:(t+1)*self.be.bsz] = z

                # handle input to LUT
                if self.hasLUT:
                    z_argmax[:] = self.be.argmax(z, axis=0)
                    z = z_argmax

            x = self.xbuf

        if inference:
            self.revert_tensors()

        return x
def fprop ( self , inputs , inference = False , beta = 0.0 ) : # make sure we are in the correct decoder mode self . decoder . switch_mode ( inference ) if not inference : # load data ( x , z ) = inputs # fprop through Encoder layers x = self . encoder . fprop ( x , inference = inference , beta = 0.0 ) # get encoder hidden state init_state_list = self . encoder . get_final_states ( self . decoder_connections ) # fprop through Decoder layers x = self . decoder . fprop ( z , inference = inference , init_state_list = init_state_list ) else : # Loopy inference # prep data x = inputs new_steps = 1 if self . hasLUT : z_shape = new_steps else : z_shape = ( self . out_shape [ 0 ] , new_steps ) z = x . backend . iobuf ( z_shape ) # encoder x = self . encoder . fprop ( x , inference = inference , beta = 0.0 ) # get encoder hidden state init_state_list = self . encoder . get_final_states ( self . decoder_connections ) # decoder steps = self . in_shape [ 1 ] if self . hasLUT : z_argmax = x . backend . zeros ( ( 1 , z . shape [ 0 ] * z . shape [ 1 ] ) ) for t in range ( steps ) : z = self . decoder . fprop ( z , inference = inference , init_state_list = init_state_list ) # transfer hidden state from DECODER to next step init_state_list = [ recurrent . final_state ( ) for recurrent in self . decoder . _recurrent ] # and write to output buffer self . xbuf [ : , t * self . be . bsz : ( t + 1 ) * self . be . bsz ] = z # handle input to LUT if self . hasLUT : z_argmax [ : ] = self . be . argmax ( z , axis = 0 ) z = z_argmax x = self . xbuf if inference : self . revert_tensors ( ) return x