NVlabs / nvdiffrast

Nvdiffrast - Modular Primitives for High-Performance Differentiable Rendering
Other
1.35k stars 144 forks source link

DeprecationWarning: 'saved_variables' is deprecated; use 'saved_tensors' #36

Closed Daiver closed 3 years ago

Daiver commented 3 years ago

Hi! I just played a little bit with optimization and suddenly faced with following warnings:

/home/daiver/coding/nvdiffrast/nvdiffrast/torch/ops.py:324: DeprecationWarning: 'saved_variables' is deprecated; use 'saved_tensors'
  attr, rast, tri, rast_db = ctx.saved_variables
/home/daiver/coding/nvdiffrast/nvdiffrast/torch/ops.py:182: DeprecationWarning: 'saved_variables' is deprecated; use 'saved_tensors'
  pos, tri, out = ctx.saved_variables
/home/daiver/coding/nvdiffrast/nvdiffrast/torch/ops.py:583: DeprecationWarning: 'saved_variables' is deprecated; use 'saved_tensors'
  color, rast, pos, tri = ctx.saved_variables
/home/daiver/coding/nvdiffrast/nvdiffrast/torch/ops.py:418: DeprecationWarning: 'saved_variables' is deprecated; use 'saved_tensors'
  tex, uv, uv_da, mip_level_bias, *mip_stack = ctx.saved_variables
/home/daiver/coding/nvdiffrast/nvdiffrast/torch/ops.py:324: DeprecationWarning: 'saved_variables' is deprecated; use 'saved_tensors'
  attr, rast, tri, rast_db = ctx.saved_variables
/home/daiver/coding/nvdiffrast/nvdiffrast/torch/ops.py:182: DeprecationWarning: 'saved_variables' is deprecated; use 'saved_tensors'
  pos, tri, out = ctx.saved_variables

// same lines because i run nvdiffrast in optimization loop

My torch version: 1.9.0+cu102, my nvdiffrast version: 0.2.5.

Currently i cannot create minimal example, but it looks like this issue can be fixed via simple renaming. Please let me know if you still need minimal example or any additional information. Thank you for great library!

s-laine commented 3 years ago

Thanks for the report @Daiver. It indeed looks like the code should be using ctx.saved_tensors instead of the deprecated name. I wonder why I haven't seen these warnings myself, given that the field was renamed several years ago already, in PyTorch 0.4.0.

I'll fix this in the next release - leaving the issue open until then.

s-laine commented 3 years ago

Fix included in v0.2.6, closing.