Help Center/ Atlas 300 Application (Model 3000)/ TE API Reference/ Compute APIs/ te.lang.cce.reduce_prod(raw_tensor, axis, keepdims=False)
Updated on 2022-03-13 GMT+08:00

te.lang.cce.reduce_prod(raw_tensor, axis, keepdims=False)

Performs multiplication based on a certain axis to reduce dimensions. The supported type is float16. The data types int8, uint8, int32, and float32 are converted to float16.

This API is defined in reduction_compute.py.

Parameter Description

  • raw_tensor: input tensor, tvm.tensor type
  • axis: axis for the reduce operation. The value range is [–d, d – 1]. The parameter d indicates the dimension of raw_tensor, int type
  • keepdims: The default value is False, indicating that the axis length is 0 after the reduce operation. For example, if the original shape is (10, 10, 10) and keepdims=False, the shape after the reduce operation is (10, 10). If this parameter is set to True, the axis length is set to 1 after the reduce operation. For example, if the original shape is (10, 10, 10) and keepdims=True, the shape after the reduce operation is (10, 10, 1).

Return Value

res_tensor: tensor after multiplication is performed based on a certain axis, tvm.tensor type

Calling Example

shape = (1024,1024)
input_dtype = "float16"
data = tvm.placeholder(shape, name="data", dtype=input_dtype)
res = te.lang.cce.reduce_prod(data, axis=1)