Skip to main content
Log in

Mojo function

broadcast_to

broadcast_to(v: Symbol, shape: List[Dim, 0], location: Optional[_SourceLocation] = #kgen.none) -> Symbol

Broadcasts a symbolic tensor.

Broadcasts the input tensor to the specified shape. Dimensions in the input must be one or match the target dimension.

Args:

  • v (Symbol): The input symbolic tensor to broadcast. This tensor may not contain any dynamic dimensions.
  • shape (List[Dim, 0]): The new shape as a list of dimensions. Dynamic dimensions are not allowed.
  • location (Optional[_SourceLocation]): An optional location for a more specific error message.

Returns:

A symbolic tensor with the same elements as the original tensor, but in a new shape. Its symbolic shape is the same as shape.

Was this page helpful?