最近遇到代码中的一个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.

本文讨论了在PyTorch中遇到的nn.functional.upsample被弃用的问题,并指出应使用nn.functional.interpolate。作者解释了用户对于layer和function困惑的情况,提出可以将function包装成layer以便在sequential模型中使用。
最低0.47元/天 解锁文章
624

被折叠的 条评论
为什么被折叠?



