TTShape#

class TTShape#

Tile tensor shape. Contains meta data defining packing details of a tile tensor. Printable to a string in tile tensor shape notation.

add_dim(*args, **kwargs)#

Overloaded function.

  1. add_dim(self: pyhelayers.TTShape, dim: pyhelayers.TTDim, place: int = -1) -> None

  2. add_dim(self: pyhelayers.TTShape, original_size: int, tile_size: int, num_duplicated: int = 1, are_unused_slots_unkown: bool = False, is_interleaved: bool = False, is_complex_packed: bool = False) -> None

apply_compatibility_adjustments(self: pyhelayers.TTShape, other: pyhelayers.TTShape, action_type: pyhelayers.ActionType) None#
are_all_dims_incomplete(self: pyhelayers.TTShape) bool#
assert_compatible(self: pyhelayers.TTShape, other: pyhelayers.TTShape, action_type: pyhelayers.ActionType = <ActionType.OTHER_ACTION_TYPE: 2>, text: str = '') None#
clear_unknowns(self: pyhelayers.TTShape) None#
contains_unknown_unused_slots(self: pyhelayers.TTShape) bool#
get_dim(*args, **kwargs)#

Overloaded function.

  1. get_dim(self: pyhelayers.TTShape, dim: int) -> pyhelayers.TTDim

  2. get_dim(self: pyhelayers.TTShape, dim: int) -> pyhelayers.TTDim

get_external_sizes(self: pyhelayers.TTShape) numpy.ndarray[numpy.int32]#
get_incomplete_tile_sizes_and_interleaved(self: pyhelayers.TTShape) pyhelayers.TTShape#
get_num_dims(self: pyhelayers.TTShape) int#
get_num_slots_in_tile(self: pyhelayers.TTShape) int#
get_num_used_tiles(self: pyhelayers.TTShape) int#
get_original_sizes(self: pyhelayers.TTShape, include_duplications: bool = False) numpy.ndarray[numpy.int32]#
get_rotate_offset_of_dim(self: pyhelayers.TTShape, i: int) int#
get_sub_shape(self: pyhelayers.TTShape, first: int, last: int) pyhelayers.TTShape#

Returns a sub-TTShape of dimensions [first,last).

Parameters:
  • first (int) – The start index of the first dimension.

  • last (int) – The ending index of the required sub shape.

Returns:

The sub shape of dimensions [first, last)

Return type:

TTShape

get_tile_sizes(self: pyhelayers.TTShape) numpy.ndarray[numpy.int32]#
get_with_duplicated_dim(self: pyhelayers.TTShape, dim: int) pyhelayers.TTShape#

Get a copy of current ttshape with the specified dimension fully duplicated along tile size.

Parameters:

dim (int) – Dimension to duplicate

get_with_duplicated_dims(self: pyhelayers.TTShape, dims_to_duplicate: numpy.ndarray[numpy.int32]) pyhelayers.TTShape#

Get a copy of current ttshape with the specified dimensions fully duplicated along tile size.

Parameters:

dims_to_duplicate (pyarray<int>) – Dimensions to duplicate

insert_dim_at(self: pyhelayers.TTShape, dim: pyhelayers.TTDim, pos: int) None#

Inserts a dimension at given position. If it is inserted at pos i, current dimension at i becomes i+1.

Parameters:
  • dim (TTDim) – Dimension to add.

  • pos (int) – Position to insert to.

is_compatible(self: pyhelayers.TTShape, other: pyhelayers.TTShape, actionType: pyhelayers.ActionType = <ActionType.OTHER_ACTION_TYPE: 2>) bool#
is_diagonalized(self: pyhelayers.TTShape) bool#
Returns whether this shape is diagonalized in its first two

dimensions.

is_first_non_degenerate_tile_dim(self: pyhelayers.TTShape, dim: int) bool#
is_incomplete(self: pyhelayers.TTShape) bool#
set_all_unused_slots_unknown(self: pyhelayers.TTShape) None#

Turns on the unknown flag for all dimensions which have unused slots.

set_diagonalized(self: pyhelayers.TTShape, val: bool) None#

Set the diagonalized flag of this shape. Diagonalized shapes must satisfy: - At least 2 dims - Dims 0-1 not duplicated, interleaved, or complex packed. - Original size of dim 0 must be divisible by tileSize[0]*tileSize[1] :param val: New value.

set_original_sizes(self: pyhelayers.TTShape, org_sizes: numpy.ndarray[numpy.int32], keep_interleaved_external_sizes: bool = False) None#
tile_layout_to_string(self: pyhelayers.TTShape) str#