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 struct

StaticBroadcastTo

struct StaticBroadcastTo

Registers the mo.static.broadcast_to graph op with the graph compiler.

Implemented traits​

AnyType, ImplicitlyDeletable

Methods​

build_view​

static def build_view[out_rank: Int](x: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=x.static_spec]) -> IndexList[out_rank]

Returns:

IndexList[out_rank]

get_view_strides_list​

static def get_view_strides_list[out_rank: Int, in_rank: Int, input_shape: IntTuple, input_strides: IntTuple]() -> IndexList[out_rank]

Returns:

IndexList[out_rank]

update_input_view​

static def update_input_view[dtype: DType, in_rank: Int, out_rank: Int, //, output_static_shape: IntTuple](x: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=x.static_spec], output_shape: IndexList[out_rank]) -> ManagedTensorSlice[IOSpec[_, _].Input, static_spec=x.static_spec.with_int_tuple_layout[out_rank, output_static_shape, StaticBroadcastTo.get_view_strides_list[out_rank, in_rank, StaticTensorSpec[dtype, in_rank, x.static_spec.static_layout, x.static_spec.InFusion, x.static_spec.OutFusion, x.static_spec.ComputeFusion, x.static_spec.ComputeFusionTile, x.static_spec.OutFusionTile].shape_tuple, StaticTensorSpec[dtype, in_rank, x.static_spec.static_layout, x.static_spec.InFusion, x.static_spec.OutFusion, x.static_spec.ComputeFusion, x.static_spec.ComputeFusionTile, x.static_spec.OutFusionTile].strides_tuple]()]()]

Returns:

ManagedTensorSlice[IOSpec[_, _].Input, static_spec=x.static_spec.with_int_tuple_layout[out_rank, output_static_shape, StaticBroadcastTo.get_view_strides_list[out_rank, in_rank, StaticTensorSpec[dtype, in_rank, x.static_spec.static_layout, x.static_spec.InFusion, x.static_spec.OutFusion, x.static_spec.ComputeFusion, x.static_spec.ComputeFusionTile, x.static_spec.OutFusionTile].shape_tuple, StaticTensorSpec[dtype, in_rank, x.static_spec.static_layout, x.static_spec.InFusion, x.static_spec.OutFusion, x.static_spec.ComputeFusion, x.static_spec.ComputeFusionTile, x.static_spec.OutFusionTile].strides_tuple]()]()]

execute​

static def execute[target: StringSlice[ImmStaticOrigin], dtype: DType, in_rank: Int, out_rank: Int, _trace_name: StringSlice[ImmStaticOrigin]](z: ManagedTensorSlice[IOSpec[_, _].Output, static_spec=z.static_spec], x: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=x.static_spec], output_shape: IndexList[out_rank], ctx: DeviceContext)