UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead. warnings.warn

  def forward(self,x):
    x=F.sigmoid(self.hidden(x))
    x=self.predict(x)
    return x

F.sigmoid出错  

UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.
  warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead."

解决方法:

F.sigmoid(self.hidden(x)) 
#修改成以下语句
torch.sigmoid(self.hidden(x))

你可能感兴趣的:(深度学习)