当前位置:   article > 正文

pytorch中layer和function的区别_pytorch layer和 的区别

pytorch layer和 的区别

最近遇到代码中的一个warining, UserWarning: nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.
  warnings.warn("nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.")

然后看到一个人的提问,“

I just need a layer, not a function.

If nn.Upsample is deprecated, i cannot find any layer to replace it.

F.upsample and F.interpolate may be similar, but there is no nn.Interpolate, and I don’t know why.

让我这个平时没有特别区别function和layer的用法的人一愣。。。

You could probably just wrap F.interpolate into a nn.Module ans still use it in your sequential model. Have a look at this for an example.

class Interpolate
本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号