# tensorplay._shape_funcs API Source: https://www.tensorplay.cn/docs/api/tensorplay._shape_funcs.html ## Functions 5 [#](#api-tensorplay._shape_funcs.block_diag) ### block_diag function[Full reference ↗](/docs/generated/tensorplay._shape_funcs.block_diag.html) ```python tensorplay._shape_funcs.block_diag(*tensors) ``` Builds a block diagonal matrix from the given blocks. 0-D blocks become 1x1 matrices and 1-D blocks become single rows. The blocks are promoted to one type and must share a device; the zeros around them are made on that device by the operator itself. [#](#api-tensorplay._shape_funcs.broadcast_shapes) ### broadcast_shapes function[Full reference ↗](/docs/generated/tensorplay._shape_funcs.broadcast_shapes.html) ```python tensorplay._shape_funcs.broadcast_shapes(*shapes) ``` Returns the broadcast shape of the given shapes (right-aligned). [#](#api-tensorplay._shape_funcs.broadcast_tensors) ### broadcast_tensors function[Full reference ↗](/docs/generated/tensorplay._shape_funcs.broadcast_tensors.html) ```python tensorplay._shape_funcs.broadcast_tensors(*tensors) ``` Broadcasts the given tensors to a common shape. [#](#api-tensorplay._shape_funcs.tensordot) ### tensordot function[Full reference ↗](/docs/generated/tensorplay._shape_funcs.tensordot.html) ```python tensorplay._shape_funcs.tensordot(input, other, dims=2) ``` Contracts input and other over the given dimensions. dims may be a non-negative int (contract the last dims dims of input with the first dims dims of other) or a pair (dims_a, dims_b) of dimension lists paired positionally. [#](#api-tensorplay._shape_funcs.unravel_index) ### unravel_index function[Full reference ↗](/docs/generated/tensorplay._shape_funcs.unravel_index.html) ```python tensorplay._shape_funcs.unravel_index(indices, shape) ``` Converts flat indices into coordinate tuples (one LongTensor per dim).