2021
07-08
07-08
pytorch 中nn.Dropout的使用说明
看代码吧~ClassUSeDropout(nn.Module):def__init__(self):super(DropoutFC,self).__init__()self.fc=nn.Linear(100,20)self.dropout=nn.Dropout(p=0.5)defforward(self,input):out=self.fc(input)out=self.dropout(out)returnoutNet=USeDropout()Net.train()示例代码如上,直接调用nn.Dropout即可,但是注意在调用时要将模型参数传入。补充:...
继续阅读 >