Mojo function
broadcast_impl
broadcast_impl[dtype: DType](axis: Int, output: TileTensor[dtype, linear_idx_type=output.linear_idx_type, element_size=output.element_size], input: TileTensor[dtype, linear_idx_type=input.linear_idx_type, element_size=input.element_size], input_prev_axis_stride: Int, output_prev_axis_stride: Int, input_offset: Int, output_offset: Int, rightmost_broadcast_axis: Int)
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.
Args:
- βaxis (
Int): The axis value. - βoutput (
TileTensor[dtype, linear_idx_type=output.linear_idx_type, element_size=output.element_size]): The output buffer. - βinput (
TileTensor[dtype, linear_idx_type=input.linear_idx_type, element_size=input.element_size]): The input buffer. - βinput_prev_axis_stride (
Int): The stride at axisaxis - 1for input. - βoutput_prev_axis_stride (
Int): The stride at axisaxis - 1for output. - βinput_offset (
Int): The offset at which we start copying data from. - βoutput_offset (
Int): The offset at which we start copying data to. - βrightmost_broadcast_axis (
Int): The largest axis at which we need to duplicateinputdata.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!