reduce_prod
Description
Reduces dimensions by computing the product of elements across dimensions.
Prototype
reduce_prod(raw_tensor, axis, keepdims=False)
Parameters
- raw_tensor: a tvm.tensor for the input tensor
Atlas 200/300/500 Inference Product : supports float16 and float32.Atlas Training Series Product : supports float16 and float32. - axis: an int or a list of ints to reduce. The value range is [–d, d – 1], where d indicates the dimension count of raw_tensor.
- keepdims: defaults to False, indicating that the axis length is 0 after reduction. For example, if the original shape is (10, 10, 10) and keepdims is set to False, the shape after reduction is (10, 10). If this parameter is set to True, the axis length is 1 after reduction. For example, if the original shape is (10, 10, 10) and keepdims is set to True, the shape after reduction is (10, 10, 1).
Returns
res_tensor: a tvm.tensor for the result tensor
Restrictions
Due to the format restrictions of the computing platform, the reduced data needs to be rearranged for subsequent operations. Do not add vector computations following a reduce operation.
Applicability
Example
from tbe import tvm from tbe import dsl shape = (1024,1024) input_dtype = "float16" data = tvm.placeholder(shape, name="data", dtype=input_dtype) res = dsl.reduce_prod(data, axis=1)
Parent topic: Math Compute APIs