asc2.reduce_prod
- asc2.reduce_prod(input: LocalTensor, *dims: int, keep_dims: bool = False) LocalTensor
Returns the product of each row of the
inputtensor in the given dimensionsdims.Dimensions
dimsare squeezed, resulting the output tensor having fewer dimensions than input, unlesskeep_dims=Trueis provided.The supported data types for the input are:
float32. Reduction to a single scalar value is not supported.- Parameters:
input – The input tensor
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
- Raises:
TypeError – If input is not a
LocalTensor, keep_dims is not a bool, or dims contains non-integer valuesRuntimeError – If input dtype is not supported, if
dimsexplicitly lists all dimensions, or if reducing to a scalar (no dims provided)
Examples
Reduce tensor by first (outermost) dimension, resulting tensor having the shape [256], each element is product of 128 elements in corresponding column:
input = asc2.copy_in(x, [0, 0], [128, 256]) result = asc2.reduce_prod(0)
This function can also be called as a member function on
LocalTensor, asinput.prod(...)instead ofreduce_prod(input, ...).