FilesLast commitLast update
13 days ago
2 months ago
2 months ago
19 days ago
16 days ago
12 days ago
2 months ago
1 month ago
16 days ago
12 days ago
23 days ago
10 days ago
README

ReduceMean

English | 简体中文

Product Support Status

Product Supported
Ascend 950PR&950DT products √
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products ×
Atlas inference products ×
Atlas training products ×

Function Description

  • Operator function: computes the average value of a multi-dimensional vector along the specified dimensions.
  • Examples:
    • Example 1: Defines the specified computation dimension (Reduce axis) as the R axis and the non-specified dimension (Normal axis) as the A axis. As shown in the following figures, the computation is performed on a 2D matrix with the shape (2, 3). The average value is computed for the data on the first dimension, and the output is [2.5, 3.5, 4.5]. The average value is computed for the data on the second dimension, and the output is [2, 5].

      Figure 1 Example of ReduceMean computation along the first dimension alt text

      Figure 2 Example of ReduceMean computation along the last dimension alt text

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Input Input tensor complex128, complex64, double, float32, float16, int64, int32, int16, int8
uint64, uint32, uint16, uint8, bfloat16
ND
axes Input Dimensions to reduce. Supports int, list, tuple, or NoneType. The data type must be int32 or int64.
If the value is None, all dimensions are reduced. The value range is [-rank(x), rank(x)].
int32, int64 ND
keep_dims Attribute Optional Boolean, default false. If true, the reduced dimension with length 1 is retained;
if false, the rank of the tensor is reduced by 1 for each entry in axis.
bool ND
noop_with_empty_axes Attribute Optional Boolean, default true. If true, no reduction is performed when axes = [];
if false, all dimensions are reduced when axes = [].
bool ND
y Output Output tensor, with the same type and format as the input tensor x Same as the input tensor x ND

Constraint Description

  • The dimension of axes must be greater than 0.
  • Dimensions of the input vector: a minimum of 1 dimension and a maximum of 8 dimensions.

Invocation Description

Invocation Method Sample Code Description
aclnn invocation test_aclnn_mean_v2 Invokes the ReduceMean operator through the aclnnMeanV2 API.
aclnn invocation test_aclnn_global_average_pool Invokes the ReduceMean operator through the aclnnGlobalAveragePool API.
Graph-mode invocation test_geir_reduce_mean Invokes the ReduceMean operator by building a graph through the operator IR.