(self)
Allocates the host and device input data buffers
        and any other associated storage.

        `self.inpbuf` is the on-device buffer for the input minibatch
        `self.mini_batch_in` is the on-host buffer for the input minibatch
        `self.mean` is the on-device buffer of the mean array
Allocates the host and device input data buffers
        and any other associated storage.
Allocates the host and device input data buffers and any other associated storage .
def allocate_inputs(self):
        """
        Allocates the host and device input data buffers
        and any other associated storage.

        `self.inpbuf` is the on-device buffer for the input minibatch
        `self.mini_batch_in` is the on-host buffer for the input minibatch
        `self.mean` is the on-device buffer of the mean array
        """
        # on device minibatch_buffer (input)
        self.inpbuf = self.be.iobuf(self.inp.shape[1])

        # setup host buffer for a mini_batch
        self.mini_batch_in = np.zeros(self.inpbuf.shape)

        self.mean = None
        # the 'mean' dataset is the the mean values to subtract
        if 'mean' in self.hdf_file:
            mns_ = np.array(self.hdf_file['mean']).flatten()
            if mns_.size != self.inp.shape[1]:
                # channel by channel mean
                # there should be 1 element per channel
                assert mns_.size == self.lshape[0], 'mean image size mismatch'
                # need to have 2-d array for broadcasting
                mns_ = mns_.reshape((self.lshape[0], 1)).copy()
                # make channel-by-channel mean subtraction view
                self.meansub_view = self.inpbuf.reshape((self.lshape[0], -1))
            else:
                self.meansub_view = self.inpbuf

            self.mean = self.be.array(mns_)
def allocate_inputs ( self ) : # on device minibatch_buffer (input) self . inpbuf = self . be . iobuf ( self . inp . shape [ 1 ] ) # setup host buffer for a mini_batch self . mini_batch_in = np . zeros ( self . inpbuf . shape ) self . mean = None # the 'mean' dataset is the the mean values to subtract if 'mean' in self . hdf_file : mns_ = np . array ( self . hdf_file [ 'mean' ] ) . flatten ( ) if mns_ . size != self . inp . shape [ 1 ] : # channel by channel mean # there should be 1 element per channel assert mns_ . size == self . lshape [ 0 ] , 'mean image size mismatch' # need to have 2-d array for broadcasting mns_ = mns_ . reshape ( ( self . lshape [ 0 ] , 1 ) ) . copy ( ) # make channel-by-channel mean subtraction view self . meansub_view = self . inpbuf . reshape ( ( self . lshape [ 0 ] , - 1 ) ) else : self . meansub_view = self . inpbuf self . mean = self . be . array ( mns_ )