How to address "UserWarning: ... for interpolate/upsample" issue with Mask R-CNN?

Hello Forum!

I am experimenting with torchvision’s Mask R-CNN model, and it issues
a UserWarning during the forward pass:

UserWarning: The default behavior for interpolate/upsample with float
scale_factor changed in 1.6.0 to align with other frameworks/libraries,
and uses scale_factor directly, instead of relying on the computed
output size. If you wish to keep the old behavior, please set
recompute_scale_factor=True. See the documentation of nn.Upsample
for details.

First, can I safely ignore this warning?

If not, what would be the most practical way to address it?

Some context:

This is something of a known issue. See for example:

(Here, the “interpolate/upsample” issue is mentioned along side the
more central “overload of nonzero” issue.)

I see this issue running, for example, pytorch/torchvision version
1.8.0.dev20201203/0.9.0.dev20201203 (as well as on a stable

Note that recompute_scale_factor isn’t mentioned in the
documentation for nn.Upsample, although it is in

Thanks for any advice.

K. Frank

I’ve seen the same warning and was also wondering, if the code should be adapted.

CC @fmassa
Should the old behavior be used for the interpolation or is the new one alright?