(self, shape)
return buf
Returns a buffer of size shape, equivalent of calling be.empty(shape).
Returns a buffer of size shape, equivalent of calling be.empty(shape).
Returns a buffer of size shape equivalent of calling be . empty ( shape ) .
def _buf_malloc(self, shape):
        """
        Returns a buffer of size shape, equivalent of calling be.empty(shape).
        """
        # create a list of buffers of the shape
        if shape not in self.buf:
            self.buf[shape] = []
        if shape not in self.buf_active:
            self.buf_active[shape] = []
        # allocate buffer if needed
        if len(self.buf[shape]) == 0:
            self.buf[shape].append(self.empty(shape, dtype=self.default_dtype))
        # get buf and put it in buf_active
        buf = self.buf[shape].pop()
        self.buf_active[shape].append(buf)
        return buf
def _buf_malloc ( self , shape ) : # create a list of buffers of the shape if shape not in self . buf : self . buf [ shape ] = [ ] if shape not in self . buf_active : self . buf_active [ shape ] = [ ] # allocate buffer if needed if len ( self . buf [ shape ] ) == 0 : self . buf [ shape ] . append ( self . empty ( shape , dtype = self . default_dtype ) ) # get buf and put it in buf_active buf = self . buf [ shape ] . pop ( ) self . buf_active [ shape ] . append ( buf ) return buf