Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pt: avoid D2H in se_e2_a #3424

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions deepmd/pt/model/descriptor/se_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,8 @@
self.reinit_exclude(exclude_types)

self.sel = sel
self.sec = torch.tensor(
np.append([0], np.cumsum(self.sel)), dtype=int, device=env.DEVICE
)
# should be on CPU to avoid D2H, as it is used as slice index
self.sec = [0, *np.cumsum(self.sel).tolist()]

Check warning on line 346 in deepmd/pt/model/descriptor/se_a.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/model/descriptor/se_a.py#L346

Added line #L346 was not covered by tests
self.split_sel = self.sel
self.nnei = sum(sel)
self.ndescrpt = self.nnei * 4
Expand Down