下载
中文
注册

def add_convolution(self: ascendie.Network, arg0: ascendie.Tensor, arg1: int, arg2: ascendie.Dims, arg3: ascendie.WeightsBuf, arg4: ascendie.WeightsBuf) -> ascendie.ConvolutionLayer

函数功能

向网络添加一个卷积层。

函数原型

add_convolution(self: ascendie.Network, arg0: ascendie.Tensor, arg1: int, arg2: ascendie.Dims, arg3: ascendie.WeightsBuf, arg4: ascendie.WeightsBuf) -> ascendie.ConvolutionLayer

约束说明

  • 不支持动态shape或者动态batch。
  • input不可以为空,数据类型必须是NCHW,维度为4维,每一维都需要大于0,且H维度取值范围在[1, 100000],W维度取值范围在[1, 4096]。
  • numOutputMap取值范围在[1, 4096]。
  • kernelHW不可以为空,维度为2维,每一维都范围是[1, 255]。
  • weights不可以为空,weights的value不可以为空,weights的count不可以是0。若已经设置了groupNum,weight的count需要满足公式weight.count = numOutputMap * (input -> GetDimensions() [1] / groupNum) * kernelHW[0] * kernelHW[1]
  • 如果bias不为空,bias的count需要与numOutputMap相同。

参数说明

参数名

参数类型

输入/输出

说明

input

Tensor

输入

卷积的输入张量。

numOutputMap

int

输入

卷积的输出特征图的数量。这里的int对应C++中的int32_t。

kernelHW

Dims

输入

卷积核的HW维度。

weights

WeightsBuf

输入

卷积核的权重。

bias

WeightsBuf

输入

卷积的偏置权重。WeightsBuf{}表示没有偏置。