Skip to content

[BUG] pt: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor). #3476

@njzjz

Description

@njzjz

Bug summary

Training a model gives the following UserWarning.

DeePMD-kit Version

v3.0.0a0-28-ged831c88

TensorFlow Version

PT v2.2.0+cu121-g8ac9b20d4b0

How did you download the software?

Built from source

Input Files, Running Commands, Error Log, etc.

/home/jz748/codes/deepmd-kit/deepmd/pt/model/task/invar_fitting.py:171: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
  torch.tensor(bias_atom_e, device=env.DEVICE).view(

Steps to Reproduce

cd examples/water/se_atten
dp --pt train input_torch.json

Further Information, Files, and Links

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions