For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo function
max
def max(x: TileTensor[Engine=x.Engine, address_space=x.address_space, linear_idx_type=x.linear_idx_type], y: TileTensor[x.dtype, x.LayoutType, Engine=y.Engine, address_space=y.address_space, linear_idx_type=y.linear_idx_type]) -> TileTensor[x.dtype, x.LayoutType, MutUntrackedOrigin, Engine=DefaultEngine[element_width=x.Engine.element_size], address_space=x.address_space]
Computes element-wise maxima into a new tensor with the input layout.
Constraints:
Shapes and strides must be static, and strides must be nonnegative.
Args:
- x (
TileTensor[Engine=x.Engine, address_space=x.address_space, linear_idx_type=x.linear_idx_type]): First input tensor. - y (
TileTensor[x.dtype, x.LayoutType, Engine=y.Engine, address_space=y.address_space, linear_idx_type=y.linear_idx_type]): Second input tensor with the same dtype, layout, and element width.
Returns:
TileTensor[x.dtype, x.LayoutType, MutUntrackedOrigin, Engine=DefaultEngine[element_width=x.Engine.element_size], address_space=x.address_space]: An independently allocated tensor with the input layout and SIMD width.
def max[axis: Int](inp: TileTensor[Engine=inp.Engine, address_space=inp.address_space, linear_idx_type=inp.linear_idx_type], outp: TileTensor[Engine=outp.Engine, address_space=outp.address_space, linear_idx_type=outp.linear_idx_type])
Computes lane-wise maxima along one outer dimension.
Constraints:
Shapes must be static. The surviving dimension and SIMD element width must match between input and output.
Parameters:
- axis (
Int): The outer dimension to reduce, either 0 or 1.
Args:
- inp (
TileTensor[Engine=inp.Engine, address_space=inp.address_space, linear_idx_type=inp.linear_idx_type]): The rank-2 input tensor, including nested outer dimensions. - outp (
TileTensor[Engine=outp.Engine, address_space=outp.address_space, linear_idx_type=outp.linear_idx_type]): The rank-1 output tensor. Values are cast to its dtype before comparison.
def max[axis: Int](inp: TileTensor[Engine=inp.Engine, address_space=inp.address_space, linear_idx_type=inp.linear_idx_type]) -> TileTensor[inp.dtype, Layout[TypeList[ComptimeInt[(Int((add (mul Coord[inp.LayoutType.__shape_types[SIMDLength((Int(1) - axis))]].static_product, inp.Engine.element_size), inp.Engine.element_size, -1)) // inp.Engine.element_size)]](), TypeList[ComptimeInt[inp.Engine.element_size]]()], MutUntrackedOrigin, Engine=DefaultEngine[element_width=Coord[ComptimeInt[inp.Engine.element_size]].static_product], address_space=inp.address_space, linear_idx_type=_get_index_type[Layout[TypeList[ComptimeInt[(Coord[inp.LayoutType.__shape_types[SIMDLength((Int(1) - axis))]].static_product * inp.Engine.element_size)]](), TypeList[ComptimeInt[Int(1)]]()]](inp.address_space)]
Computes lane-wise maxima into a new contiguous tensor.
Parameters:
- axis (
Int): The outer dimension to reduce, either 0 or 1.
Args:
- inp (
TileTensor[Engine=inp.Engine, address_space=inp.address_space, linear_idx_type=inp.linear_idx_type]): A statically shaped rank-2 tensor.
Returns:
TileTensor[inp.dtype, Layout[TypeList[ComptimeInt[(Int((add (mul Coord[inp.LayoutType.__shape_types[SIMDLength((Int(1) - axis))]].static_product, inp.Engine.element_size), inp.Engine.element_size, -1)) // inp.Engine.element_size)]](), TypeList[ComptimeInt[inp.Engine.element_size]]()], MutUntrackedOrigin, Engine=DefaultEngine[element_width=Coord[ComptimeInt[inp.Engine.element_size]].static_product], address_space=inp.address_space, linear_idx_type=_get_index_type[Layout[TypeList[ComptimeInt[(Coord[inp.LayoutType.__shape_types[SIMDLength((Int(1) - axis))]].static_product * inp.Engine.element_size)]](), TypeList[ComptimeInt[Int(1)]]()]](inp.address_space)]: A rank-1 tensor with the input dtype and SIMD element width. Adjacent
elements have disjoint storage.