Mojo function
scatter_nd_generator
scatter_nd_generator[output_type: DType, indices_type: DType, //, oob_index_strategy: ScatterOobIndexStrategy = ScatterOobIndexStrategy.UNDEFINED, target: StringSlice[StaticConstantOrigin] = StringSlice("cpu"), reduce_fn: OptionalReg[def[dtype: DType, width: Int](SIMD[dtype, width], SIMD[dtype, width]) capturing -> SIMD[dtype, width]] = None, *, _trace_description: StringSlice[StaticConstantOrigin] = StringSlice("scatter_nd")](data: TileTensor[output_type, data.LayoutType, data.origin, linear_idx_type=data.linear_idx_type, element_size=data.element_size], indices: TileTensor[indices_type, indices.LayoutType, indices.origin, linear_idx_type=indices.linear_idx_type, element_size=indices.element_size], updates: TileTensor[output_type, updates.LayoutType, updates.origin, linear_idx_type=updates.linear_idx_type, element_size=updates.element_size], output: TileTensor[output_type, output.LayoutType, output.origin, linear_idx_type=output.linear_idx_type, element_size=output.element_size], context: DeviceContextPtr = DeviceContextPtr())
Implements ONNX ScatterND operation as defined in https://github.com/onnx/onnx/blob/main/docs/Operators.md#ScatterND.
Parameters:
- output_type (
DType): Type of data, updates, and output tensors. - indices_type (
DType): Type of the indices tensor. - oob_index_strategy (
ScatterOobIndexStrategy): Strategy to handle out of bounds indices. - target (
StringSlice): Target cpu or cuda. - reduce_fn (
OptionalReg): Reduction function to apply: none (default), add, mul, max, min. - _trace_description (
StringSlice): A description of the function, used for profiling and tracing.
Args:
- data (
TileTensor): Tensor of rank data_rank >= 1. - indices (
TileTensor): Tensor of rank indices_rank containing indices for the scatter operation. - updates (
TileTensor): Tensor containing values to update output tensor based on indices tensor. - output (
TileTensor): Tensor of rank data_rank, shaped the same as data tensor. - context (
DeviceContextPtr): Pointer to DeviceContext.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!