def add_reduce(self: ascendie.Network, arg0: ascendie.Tensor, arg1: ascendie.ReduceOperation, arg2: int, arg3: bool) -> ascendie.ReduceLayer
函数功能
在网络中添加一个Reduce层。
函数原型
add_reduce(self: ascendie.Network, arg0: ascendie.Tensor, arg1: ascendie.ReduceOperation, arg2: int, arg3: bool) -> ascendie.ReduceLayer
约束说明
- reduceAxes:指定的轴必须在[0, input.ndims)有效取值范围。
- operation:必须是ReduceOperation已支持的类型。
- 当前不支持动态shape。
参数说明
参数名 |
参数类型 |
输入/输出 |
说明 |
---|---|---|---|
input |
Tensor |
输入 |
Reduce层的输入张量。 |
operation |
ReduceOperation |
输入 |
归约操作类型,取值详见ascendie.ReduceOperation |
reduceAxes |
int |
输入 |
进行归约的轴。reduceAxes是按位运算来指定在哪些轴进行操作。 例如:reduceAxes = 0b01, 指的是在dim = 0上操作;reduceAxes = 0b110, 指的是在dim = 1和dim = 2上操作。这里的int对应C++中的uint32_t。 |
keepDimensions |
bool |
输入 |
|