【发布时间】:2019-08-03 00:35:29
【问题描述】:
我遇到了这个PyTorch example for depthwise separable convolutions using the groups parameter:
class depthwise_separable_conv(nn.Module):
def __init__(self, nin, nout):
super(depthwise_separable_conv, self).__init__()
self.depthwise = nn.Conv2d(nin, nin, kernel_size=3, padding=1, groups=nin)
self.pointwise = nn.Conv2d(nin, nout, kernel_size=1)
def forward(self, x):
out = self.depthwise(x)
out = self.pointwise(out)
return out
我之前没有在 CNN 中看到任何组的使用。就这一点而言,文档也有点稀疏:
groups控制输入和输出之间的连接。in_channels和out_channels都必须能被组整除。
所以我的问题是:
- CNN 中的组是什么?
- 在哪些情况下需要使用群组?
(我猜这更笼统,而不是 PyTorch 特定的。)
【问题讨论】:
标签: neural-network deep-learning conv-neural-network pytorch