MCCNN.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:PytorchDL 作者: FredHuangBia 项目源码 文件源码
def forward(self, x):
        batchSize = x.size()[0]
        x1 = torch.zeros(batchSize, 1, 1, 21)
        x2 = torch.zeros(batchSize, 1, 1, 21)
        x3 = torch.zeros(batchSize, 1, 1, 21)
        for b in range(batchSize):
            for t in range(21):
                x1[b,0,0,t] = x.data[b,0,0,t]
                x2[b,0,0,t] = x.data[b,0,1,t]
                x3[b,0,0,t] = x.data[b,0,2,t]
        x1, x2, x3 = Variable(x1), Variable(x2), Variable(x3)
        x1, x2, x3 = self.br1.forward(x1), self.br2.forward(x2), self.br2.forward(x3)

        x = torch.cat([x1, x2, x3], 1)
        x = self.bn1(x)
        x = F.dropout(x, p=self.dropout)
        x = self.fc1(x)
        x = self.bn2(x)
        x = F.dropout(x, p=self.dropout)
        x = self.fc2(x)

        return x
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号