这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Aug 3, 2021. It is now read-only.
This repository was archived by the owner on Aug 3, 2021. It is now read-only.

Deprecation warnings migrating to 0.4 #21

@paulhendricks

Description

@paulhendricks

We see the following deprecation warnings when using PyTorch Version 0.4.0 with the DeepRecommender package. These deprecation warnings will result in errors in PyTorch Version 0.5.0. Specifically, the migration involves two changes:

  • Changing nn.init.xavier_uniform to nn.init.xavier_uniform_,
  • Instead of using loss.data[0] syntax, use loss.item().

These changes are breaking; when using PyTorch Version 0.3.0, nn.init.xavier_uniform_ and loss.item() result in AttributeError: module 'torch.nn.init' has no attribute 'xavier_uniform_' and 'Variable' object has no attribute 'item' , respectively.

Deprecation warnings:

DeepRecommender/reco_encoder/model/model.py:60: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.
  weight_init.xavier_uniform(w)

DeepRecommender/reco_encoder/model/model.py:72: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.
  weight_init.xavier_uniform(w)

DeepRecommender/run.py:198: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
  t_loss += loss.data[0]
[0,     0] RMSE: 3.8345311

DeepRecommender/run.py:212: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
  total_epoch_loss += loss.data[0]

DeepRecommender/run.py:74: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
  total_epoch_loss += loss.data[0]

DeepRecommender/run.py:75: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
  denom += num_ratings.data[0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions