示例#1
0
文件: Util.py 项目: evolu8/nnsandbox
    def get_capacity(self,m,n=-1):
        '''
        Ensures that the matrix has enough capacity for m rows when there are exactly n columns.
        Returns an ndarray (a view) into the first m rows of the memory.
        '''
        # Ensure columns match n exactly, and rows are at least m
        if n < 0: 
            n = self._A.shape[1]
        if m > self._A.shape[0] or n != self._A.shape[1]:
            self._A = empty((m,n))

        self._m = m

        # Return view to the first m rows
        return self._A[:m,:]
示例#2
0
    def get_capacity(self, m, n=-1):
        '''
        Ensures that the matrix has enough capacity for m rows when there are exactly n columns.
        Returns an ndarray (a view) into the first m rows of the memory.
        '''
        # Ensure columns match n exactly, and rows are at least m
        if n < 0:
            n = self._A.shape[1]
        if m > self._A.shape[0] or n != self._A.shape[1]:
            self._A = empty((m, n))

        self._m = m

        # Return view to the first m rows
        return self._A[:m, :]
示例#3
0
文件: Util.py 项目: evolu8/nnsandbox
 def __init__(self,m=1,n=1):
     self._A = empty((m,n))
     self._m = m
示例#4
0
 def __init__(self, m=1, n=1):
     self._A = empty((m, n))
     self._m = m