megengine.functional.nn.conv1d

conv1d(inp, weight, bias=None, stride=1, padding=0, dilation=1, groups=1, conv_mode='cross_correlation', compute_mode='default')[源代码]

一维卷积运算。

更多信息参见 Conv1d

参数
  • inp (Tensor) – 卷积运算的特征图。

  • weight (Tensor) – The convolution kernel.

  • bias (Optional[Tensor]) – 添加到卷积结果中的偏置量(如果给定该值)

  • stride (int) – 一维卷积运算中的步长。 默认: 1

  • padding (int) – 在输入值的空间维度上每一侧填充的尺寸。 仅支持用零值填充。 默认: 0

  • dilation (int) – 一维卷积运算的扩张值(dilation)。 默认: 1

  • groups (int) – number of groups to divide input and output channels into, so as to perform a “grouped convolution”. When groups is not 1, in_channels and out_channels must be divisible by groups, and the shape of weight should be (groups, out_channel // groups, in_channels // groups, kernel_size). Default: 1

  • conv_mode (string or mgb.opr_param_defs.Convolution.Mode) – Supports ‘cross_correlation’. Default: ‘cross_correlation’.

  • compute_mode (string or mgb.opr_param_defs.Convolution.ComputeMode) – When set to ‘default’, no special requirements will be placed on the precision of intermediate results. When set to ‘float32’, float32 would be used for accumulator and intermediate result, but only effective when input and output are of float16 dtype.

返回类型

Tensor