示例#1
0
 def __init__(self, shape, dtype=np.int32, accessor=None):
     Tensor.__init__(self, shape, dtype)
     if accessor is None:
         self.accessor = SparseTable(shape, dtype)
     else:
         assert shape == accessor.shape
         assert dtype == accessor.dtype
         self.accessor = accessor
示例#2
0
文件: dense.py 项目: haydnv/tensor.py
    def __init__(self, shape, dtype=np.int32, block_list=None):
        Tensor.__init__(self, shape, dtype)

        if block_list is None:
            self._block_list = BlockListBase(shape, dtype)
        else:
            assert isinstance(block_list, BlockList)
            assert block_list.dtype == self.dtype
            assert block_list.shape == self.shape
            self._block_list = block_list