Пример #1
0
 def _compute_type(self):
     assert len(self.shape) == 2
     tensor_shape, is_row_vector = _matrix_shape_to_tensor_shape(self.shape[0], self.shape[1])
     self._type = tblockmatrix(self.child.typ.element_type,
                               tensor_shape,
                               is_row_vector,
                               self.block_size)
Пример #2
0
 def _compute_type(self):
     assert len(self.shape) == 2
     tensor_shape, is_row_vector = _matrix_shape_to_tensor_shape(
         self.shape[0], self.shape[1])
     self._type = tblockmatrix(self.child.typ.element_type, tensor_shape,
                               is_row_vector, self.block_size,
                               self.dims_partitioned)
Пример #3
0
    def _compute_type(self):
        assert len(self.shape) == 2
        tensor_shape, is_row_vector = _matrix_shape_to_tensor_shape(
            self.shape[0], self.shape[1])

        self._type = tblockmatrix(hl.tfloat64, tensor_shape, is_row_vector,
                                  self.block_size)
Пример #4
0
    def _compute_type(self):
        shape = [self.child.typ.shape[i] for i in self.out_index_expr]
        is_row_vector = self.out_index_expr == [1]

        self._type = tblockmatrix(self.child.typ.element_type,
                                  shape,
                                  is_row_vector,
                                  self.child.typ.block_size)
Пример #5
0
 def _compute_type(self):
     assert len(self.slices) == 2
     matrix_shape = [1 + (s.stop - s.start - 1) // s.step for s in self.slices]
     tensor_shape, is_row_vector = _matrix_shape_to_tensor_shape(matrix_shape[0], matrix_shape[1])
     self._type = tblockmatrix(self.child.typ.element_type,
                               tensor_shape,
                               is_row_vector,
                               self.child.typ.block_size)
Пример #6
0
    def _compute_type(self):
        shape = [self.child.typ.shape[i] for i in self.out_index_expr]
        is_row_vector = self.out_index_expr == [1]

        self._type = tblockmatrix(self.child.typ.element_type,
                                  shape,
                                  is_row_vector,
                                  self.child.typ.block_size)
Пример #7
0
    def _compute_type(self):
        child_type = self.child.typ
        if isinstance(child_type, tarray):
            element_type = child_type._element_type
        else:
            element_type = child_type

        self._type = tblockmatrix(element_type, self.shape, self.block_size,
                                  self.dims_partitioned)
Пример #8
0
    def _compute_type(self):
        l_rows, l_cols = tensor_shape_to_matrix_shape(self.left)
        r_rows, r_cols = tensor_shape_to_matrix_shape(self.right)
        assert l_cols == r_rows

        tensor_shape, is_row_vector = _matrix_shape_to_tensor_shape(
            l_rows, r_cols)
        self._type = tblockmatrix(self.left.typ.element_type, tensor_shape,
                                  is_row_vector, self.left.typ.block_size)
Пример #9
0
    def _compute_type(self):
        child_type = self.child.typ
        if isinstance(child_type, tarray):
            element_type = child_type._element_type
        else:
            element_type = child_type

        assert len(self.shape) == 2
        tensor_shape, is_row_vector = _matrix_shape_to_tensor_shape(self.shape[0], self.shape[1])
        self._type = tblockmatrix(element_type, tensor_shape, is_row_vector, self.block_size)
Пример #10
0
    def _compute_type(self):
        child_type = self.child.typ
        if isinstance(child_type, tarray):
            element_type = child_type._element_type
        else:
            element_type = child_type

        assert len(self.shape) == 2
        tensor_shape, is_row_vector = _matrix_shape_to_tensor_shape(self.shape[0], self.shape[1])
        self._type = tblockmatrix(element_type, tensor_shape, is_row_vector, self.block_size)
Пример #11
0
    def _compute_type(self):
        assert len(self.indices_to_keep) == 2
        shape = [len(idxs) if len(idxs) != 0 else self.child.typ.shape[i] for i, idxs in
                 enumerate(self.indices_to_keep)]

        tensor_shape, is_row_vector = _matrix_shape_to_tensor_shape(shape[0], shape[1])
        self._type = tblockmatrix(self.child.typ.element_type,
                                  tensor_shape,
                                  is_row_vector,
                                  self.child.typ.block_size)
Пример #12
0
    def _compute_type(self):
        assert len(self.indices_to_keep) == 2
        shape = [len(idxs) if len(idxs) != 0 else self.child.typ.shape[i] for i, idxs in
                 enumerate(self.indices_to_keep)]

        tensor_shape, is_row_vector = _matrix_shape_to_tensor_shape(shape[0], shape[1])
        self._type = tblockmatrix(self.child.typ.element_type,
                                  tensor_shape,
                                  is_row_vector,
                                  self.child.typ.block_size)
Пример #13
0
    def _compute_type(self):
        l_rows, l_cols = tensor_shape_to_matrix_shape(self.left)
        r_rows, r_cols = tensor_shape_to_matrix_shape(self.right)
        assert l_cols == r_rows

        tensor_shape, is_row_vector = _matrix_shape_to_tensor_shape(l_rows, r_cols)
        self._type = tblockmatrix(self.left.typ.element_type,
                                  tensor_shape,
                                  is_row_vector,
                                  self.left.typ.block_size)
Пример #14
0
    def _compute_type(self):
        child_matrix_shape = tensor_shape_to_matrix_shape(self.child)
        if self.out_index_expr == [0, 1]:
            is_row_vector = False
            shape = []
        elif self.out_index_expr == [0]:
            is_row_vector = True
            shape = [child_matrix_shape[1]]
        elif self.out_index_expr == [1]:
            is_row_vector = False
            shape = [child_matrix_shape[0]]
        else:
            raise ValueError("Invalid out_index_expr")

        self._type = tblockmatrix(self.child.typ.element_type, shape,
                                  is_row_vector, self.child.typ.block_size)
Пример #15
0
    def _compute_type(self):
        assert len(self.indices_to_keep) == 2

        child_tensor_shape = self.child.typ.shape
        child_ndim = len(child_tensor_shape)
        if child_ndim == 1:
            if self.child.typ.is_row_vector:
                child_matrix_shape = [1, child_tensor_shape[0]]
            else:
                child_matrix_shape = [child_tensor_shape[0], 1]
        else:
            child_matrix_shape = child_tensor_shape

        matrix_shape = [len(idxs) if len(idxs) != 0 else child_matrix_shape[i] for i, idxs in
                 enumerate(self.indices_to_keep)]

        tensor_shape, is_row_vector = _matrix_shape_to_tensor_shape(matrix_shape[0], matrix_shape[1])
        self._type = tblockmatrix(self.child.typ.element_type,
                                  tensor_shape,
                                  is_row_vector,
                                  self.child.typ.block_size)
Пример #16
0
 def _compute_type(self):
     self._type = tblockmatrix(self.child.typ.element_type, self.shape,
                               self.block_size, self.dims_partitioned)
Пример #17
0
    def _compute_type(self):
        assert len(self.shape) == 2
        tensor_shape, is_row_vector = _matrix_shape_to_tensor_shape(self.shape[0], self.shape[1])

        self._type = tblockmatrix(hl.tfloat64, tensor_shape, is_row_vector, self.block_size)