(self, inputs)
Initialize buffers for recurrent internal units and outputs.
        Buffers are initialized as 2D tensors with second dimension being steps * batch_size
        A list of views are created on the buffer for easy manipulation of data
        related to a certain time step

        Arguments:
            inputs (Tensor): input data as 2D tensor. The dimension is
                             (input_size, sequence_length * batch_size)
Initialize buffers for recurrent internal units and outputs.
        Buffers are initialized as 2D tensors with second dimension being steps * batch_size
        A list of views are created on the buffer for easy manipulation of data
        related to a certain time step
Initialize buffers for recurrent internal units and outputs . Buffers are initialized as 2D tensors with second dimension being steps * batch_size A list of views are created on the buffer for easy manipulation of data related to a certain time step
def init_buffers(self, inputs):
        """
        Initialize buffers for recurrent internal units and outputs.
        Buffers are initialized as 2D tensors with second dimension being steps * batch_size
        A list of views are created on the buffer for easy manipulation of data
        related to a certain time step

        Arguments:
            inputs (Tensor): input data as 2D tensor. The dimension is
                             (input_size, sequence_length * batch_size)

        """
        if self.x is None or self.x.base is not inputs:
            if self.x:
                for buf in self.bufs_to_reset:
                    buf[:] = 0

            assert inputs.size == self.nin * self.nsteps * self.be.bsz

            self.x = inputs.reshape(self.nin, self.nsteps * self.be.bsz)
            nin = self.i_shape[0]
            if self.split_inputs:
                self.x_f = self.x[:nin]
                self.x_b = self.x[nin:]
            else:
                self.x_f = self.x
                self.x_b = self.x

            self.xs_f = get_steps(self.x_f, self.i_shape)
            self.xs_b = get_steps(self.x_b, self.i_shape)
            self.x_f_v = self.x_f.reshape(nin, -1)
            self.x_b_v = self.x_b.reshape(nin, -1)
def init_buffers ( self , inputs ) : if self . x is None or self . x . base is not inputs : if self . x : for buf in self . bufs_to_reset : buf [ : ] = 0 assert inputs . size == self . nin * self . nsteps * self . be . bsz self . x = inputs . reshape ( self . nin , self . nsteps * self . be . bsz ) nin = self . i_shape [ 0 ] if self . split_inputs : self . x_f = self . x [ : nin ] self . x_b = self . x [ nin : ] else : self . x_f = self . x self . x_b = self . x self . xs_f = get_steps ( self . x_f , self . i_shape ) self . xs_b = get_steps ( self . x_b , self . i_shape ) self . x_f_v = self . x_f . reshape ( nin , - 1 ) self . x_b_v = self . x_b . reshape ( nin , - 1 )