This issue is part of a Codex global repository scan.
Problem:
load_data_for_model() moves data to self.device, but ToWannier90._get_data_and_blocks() calls .numpy() directly on tensors for positions, scaled positions, and cell.
Code reference:
https://github.com/deepmodeling/deeptb/blob/86c60c73996f0dd961c3138f2e88424382cb734e/dptb/postprocess/interfaces.py#L44-L49
Impact:
Exporting with a CUDA device raises TypeError: can't convert cuda tensor to numpy instead of writing Wannier90 files.
Suggested fix:
Convert tensors with .detach().cpu().numpy() before passing data to NumPy or file-writing code.
This issue is part of a Codex global repository scan.
Problem:
load_data_for_model()moves data toself.device, butToWannier90._get_data_and_blocks()calls.numpy()directly on tensors for positions, scaled positions, and cell.Code reference:
https://github.com/deepmodeling/deeptb/blob/86c60c73996f0dd961c3138f2e88424382cb734e/dptb/postprocess/interfaces.py#L44-L49
Impact:
Exporting with a CUDA device raises
TypeError: can't convert cuda tensor to numpyinstead of writing Wannier90 files.Suggested fix:
Convert tensors with
.detach().cpu().numpy()before passing data to NumPy or file-writing code.