Mojo function
max
max[axis: Int](inp: LayoutTensor[inp.dtype, inp.layout, inp.origin, address_space=inp.address_space, element_layout=inp.element_layout, layout_int_type=inp.layout_int_type, linear_idx_type=inp.linear_idx_type, masked=inp.masked, alignment=inp.alignment], outp: LayoutTensor[outp.dtype, outp.layout, outp.origin, address_space=outp.address_space, element_layout=outp.element_layout, layout_int_type=outp.layout_int_type, linear_idx_type=outp.linear_idx_type, masked=outp.masked, alignment=outp.alignment])
Computes maximum reduction along specified axis.
Reduces the input tensor by taking maximum elements along the specified axis and stores the result in the output tensor.
Constraints:
All tensors must have statically known shapes.
outp.rank must equal inp.rank - 1.
Non-reduction dimensions must match between inp and outp.
Currently only supports rank-2 inputs.
Parameters:
- axis (
Int): The axis to take maximum along.
Args:
- inp (
LayoutTensor): The input tensor to reduce. - outp (
LayoutTensor): The output tensor to store maximum results.
max[axis: Int](inp: LayoutTensor[inp.dtype, inp.layout, inp.origin, address_space=inp.address_space, element_layout=inp.element_layout, layout_int_type=inp.layout_int_type, linear_idx_type=inp.linear_idx_type, masked=inp.masked, alignment=inp.alignment]) -> LayoutTensor[inp.dtype, _reduce_res_row_major_shape(axis, inp.layout), MutAnyOrigin, address_space=inp.address_space, element_layout=inp.element_layout, layout_int_type=inp.layout_int_type, linear_idx_type=inp.linear_idx_type]
Computes maximum reduction along specified axis, returning a new tensor.
Reduces the input tensor by taking maximum elements along the specified axis and returns a new tensor with the results.
Constraints:
All tensors must have statically known shapes.
Result will have rank equal to inp.rank - 1.
Non-reduction dimensions in the result match the input.
Currently only supports rank-2 inputs.
Parameters:
- axis (
Int): The axis to take maximum along.
Args:
- inp (
LayoutTensor): The input tensor to reduce.
Returns:
LayoutTensor: A new tensor containing the maximum values along the specified axis.
max[dtype: DType, layout: Layout](x: LayoutTensor[dtype, layout, x.origin, address_space=x.address_space, element_layout=x.element_layout, layout_int_type=x.layout_int_type, linear_idx_type=x.linear_idx_type, masked=x.masked, alignment=x.alignment], y: LayoutTensor[dtype, layout, y.origin, address_space=y.address_space, element_layout=y.element_layout, layout_int_type=y.layout_int_type, linear_idx_type=y.linear_idx_type, masked=y.masked, alignment=y.alignment]) -> LayoutTensor[dtype, layout, x.origin, address_space=x.address_space, element_layout=x.element_layout, layout_int_type=x.layout_int_type, linear_idx_type=x.linear_idx_type, masked=x.masked, alignment=x.alignment].MutableAnyType
Computes element-wise maximum of two tensors.
Returns a new tensor containing the element-wise maximum between the input tensors.
Constraints:
Input tensors must have statically known shapes and matching layouts.
Parameters:
- dtype (
DType): The data type of the input tensors. - layout (
Layout): The layout of the input tensors.
Args:
- x (
LayoutTensor): First input tensor. - y (
LayoutTensor): Second input tensor.
Returns:
LayoutTensor: A new tensor containing the element-wise maximum.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!