tilus.ir.layout.reduce

Contents

tilus.ir.layout.reduce

tilus.ir.layout.reduce(layout, dims, *, keepdims=False)[source]

Reduce the layout over the given dimensions.

The reduce function will return a new layout with the dimensions specified in dims reduced to 1. The reduced dimensions will be removed if keepdims is False, or set to 1 if keepdims is True.

Parameters:
  • layout (RegisterLayout) – The layout to reduce.

  • dims (Sequence[int]) – The dimensions to reduce. The length of dims must be less than the number of dimensions of the layout.

  • keepdims (bool) – Whether to keep the reduced dimensions in the output layout. If True, the reduced dimensions will be set to 1. Otherwise, the reduced dimensions will be removed from the output layout.

Returns:

ret – The reduced layout.

Return type:

RegisterLayout