IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo module

broadcast

Implements numpy-style tensor broadcasting for CPU and GPU targets.

Functions​

  • ​broadcast: For each axis of input, if the dimension is 1, duplicate the data at each index of the corresponding axis in output, otherwise copy over the entire axis to the corresponding axis in output.
  • ​broadcast_impl: For each axis of input ∈ [axis, rank), if the dimension is 1, duplicate the data at each index of the corresponding axis in output, otherwise copy over the entire axis to the corresponding axis in output.

Was this page helpful?