asc.language.tile.reduction_ops.reduce_prod

asc.language.tile.reduction_ops.reduce_prod(input: Tile, *dims: int, keep_dims: bool = False) Tile

Returns the product of each row of the input tile in the given dimensions dims.

Dimensions dims are squeezed, resulting the output tile having fewer dimensions than input, unless keep_dims=True is provided.

Parameters:
  • input – the input tile

  • dims – dimensions to reduce, should be in range of [0..len(input.shape)-1]

  • keep_dims – if set to True, then reduced dimensions are kept in the result shape with size of 1

Examples

Reduce tile by first (outermost) dimension, resulting tile having the shape [256], each element is product of 128 elements in corresponding column:

input = asc2.load(x, [128, 256], offsets=[0, 0])
result = asc2.reduce_prod(0)

This function can also be called as a member function on Tile, as x.prod(...) instead of reduce_prod(x, ...).