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

norm() -> linalg.norm() in lennard_jones #1898

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions torchbenchmark/models/lennard_jones/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def lennard_jones_force(r):


def make_prediction(model, drs):
norms = torch.norm(drs, dim=1).reshape(-1, 1)
norms = torch.linalg.norm(drs, dim=1).reshape(-1, 1)
energies = model(norms)

network_derivs = vmap(jacrev(model))(norms).squeeze(-1)
Expand Down Expand Up @@ -67,7 +67,7 @@ def __init__(self, test, device, batch_size=None, extra_args=[]):
self.drs = torch.outer(r, torch.tensor([1.0, 0, 0])).to(device=device)

# Generate some dummy targets based off of some interpretation of the lennard_jones force.
norms = torch.norm(self.drs, dim=1).reshape(-1, 1)
norms = torch.linalg.norm(self.drs, dim=1).reshape(-1, 1)
self.norms = norms
# Create training energies
self.training_energies = torch.stack(list(map(lennard_jones, norms))).reshape(-1, 1)
Expand Down