pub fn into_broadcast<R, T, B, D, D2>(
tensor: TensorBase<Storage<R, T, B>, D>,
shape: D2,
) -> TensorBase<Storage<R, T, B>, D2>Expand description
Broadcasts an array to a specified shape.
Row/Column Major Notice
This function behaves differently on default orders (RowMajor and ColMajor) of device.
§Parameters
-
tensor:TensorAny<R, T, B, D>- The input tensor to be broadcasted.
- Ownership of input tensor is taken.
-
shape: implDimAPI
§Returns
-
- The tensor with the given shape. It is typically not contiguous (perform
to_contigafterwards if requires a contiguous owned tensor). - Furthermore, more than one element of a broadcasted tensor may refer to a single memory location (zero strides at the broadcasted axes).
- Ownership of the returned tensor is transferred from the input tensor. Only the layout is modified; the underlying data remains unchanged.
- The tensor with the given shape. It is typically not contiguous (perform
§See also
Refer to to_broadcast for more detailed documentation.