mlx.core.conv2d#
- conv2d(input: array, weight: array, /, stride: int | tuple[int, int] = 1, padding: int | tuple[int, int] = 0, dilation: int | tuple[int, int] = 1, groups: int = 1, *, stream: None | Stream | Device = None) array #
对包含多个通道的输入执行二维卷积
- 参数:
input (array) – 输入数组,形状为
(N, H, W, C_in)
。weight (array) – 权重数组,形状为
(C_out, KH, KW, C_in)
。stride (int 或 tuple(int), 可选) – 大小为 2 的
tuple
,包含核步长。如果只指定一个数字,则所有空间维度使用相同的步长。默认值:1
。padding (int 或 tuple(int), 可选) – 大小为 2 的
tuple
,包含对称输入填充。如果只指定一个数字,则所有空间维度使用相同的填充。默认值:0
。dilation (int 或 tuple(int), 可选) – 大小为 2 的
tuple
,包含核扩张。如果只指定一个数字,则所有空间维度使用相同的扩张。默认值:1
groups (int, 可选) – 输入特征组数。默认值:
1
。
- 返回值:
卷积后的数组。
- 返回类型: