This document is relevant for: Trn1, Trn2, Trn3
nki.language.broadcast_to#
- nki.language.broadcast_to(x, shape, dtype=None)[source]#
Broadcast a tile to a new shape following numpy broadcasting rules.
((Similar to numpy.broadcast_to))
Warning
This API is experimental and may change in future releases.
If
x.shapeis already the same asshape, returnsxunchanged (or a dtype-cast copy ifdtypediffers).- Parameters:
x – the source tile in SBUF or PSUM.
shape – the target shape. Must have the same rank as
x. Each dimension must either match or be broadcast from size 1.dtype – (optional) data type to cast the output type to (see Supported Data Types for more information); if not specified, it will default to be the same as the data type of the input tile.
- Returns:
a tile with the target shape containing broadcast values from
x.
This document is relevant for: Trn1, Trn2, Trn3