x.view(x.size(0), -1)的解释
pytorch教程中,用cnn实现mnist的分类。其中class中有一段代码:def forward(self, x): x = self.conv1(x) x = self.conv2(x) # t = x.size(0) 0->50,1->32,2->7,3->7 x = x.view(x.size(0), -1) # flatten the output of conv2 to (batch_size, 32 ...
转载
2020-08-20 05:06:15 ·
947 阅读 ·
0 评论