Skip to content

Fix deprecation warnings introduced in PyTorch version >=1.10#2

Open
JulianKu wants to merge 1 commit intoandyljones:masterfrom
JulianKu:fix/deprecation-warnings
Open

Fix deprecation warnings introduced in PyTorch version >=1.10#2
JulianKu wants to merge 1 commit intoandyljones:masterfrom
JulianKu:fix/deprecation-warnings

Conversation

@JulianKu
Copy link
Copy Markdown

@JulianKu JulianKu commented Feb 9, 2022

Using megastep with PyTorch 1.10 introduces 2 deprecation warnings, which could lead to errors in future PyTorch versions.
Consequently, this pull request fixes the issues applying the officially recommended alternatives:

  1. The PyTorch torch.floor_divide function used by a tensor's __floordiv__ method and thus also invoked by the // operator is deprecated. In megastep, it is used in demo/lstm.py (l. 57) and has been replaced applying the official recommendation by using use torch.div() with rounding_mode='floor'.
  2. The AutoNonVariableTypeMode used in kernels.cu and corresponding header is deprecated. The migration guide recommends replacing it with c10::InferenceMode.

Changes in `common.h` and `kernels.cu` regarding deprecation of `AutoNonVariableTypeMode` according to [this migration guide](https://pytorch.org/cppdocs/notes/inference_mode.html#migration-guide-from-autononvariabletypemode)

Changes in `lstm.py` regarding deprecation of `__floordiv__` according to warning as given [here](https://pytorch.org/docs/1.10/generated/torch.floor_divide.html?highlight=floor_divide#torch.floor_divide)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant