cuda.tile.reduce#

cuda.tile.reduce(x, /, axis, func, identity, *, keepdims=False)#

Apply custom reduction function along axis.

Parameters:
  • x – input tile or a tuple of tiles to be reduced. If a tuple is provided, shapes of the tiles in the tuple must be broadcastable to a common shape.

  • axis (int) – an integer constant that specifies the axis to reduce along.

  • func – function for combining two values. If x is a single tile, then the function must take two 0d tile arguments and return the combined 0d tile. For example, lambda a, b: a + b or operator.add can be used to implement the sum reduction. If x is a tuple of N tiles, then the function takes 2N tiles and returns a tuple of N combined tiles. The first N arguments correspond to one of the groups of values being combined, while the rest correspond to the other.

  • identity – a constant scalar or a tuple of constant scalars that specifies the identity element of the func.

  • keepdims (bool) – True to remove the reduced axis, False to keep the axis of size 1. Default: False.

Returns:

Reduced tile, or tuple of reduced tiles, depending on the type of x.