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

[Feature Request] pt: statistics of the fitting net is not covered by UTs #3278

Closed
wanghan-iapcm opened this issue Feb 15, 2024 · 1 comment
Assignees
Milestone

Comments

@wanghan-iapcm
Copy link
Collaborator

Summary

In the torch implementation, the behavior of the fitting stats are not tested.

Detailed Description

The behavior compute_output_stats and init_fitting_stat of the torch fitting networks (see below) are not covered by unit testes. Especially the behavior when the dimension of the variables are larger than 1.

def compute_output_stats(self, merged):
energy = [item["energy"] for item in merged]
mixed_type = "real_natoms_vec" in merged[0]
if mixed_type:
input_natoms = [item["real_natoms_vec"] for item in merged]
else:
input_natoms = [item["natoms"] for item in merged]
tmp = compute_output_bias(energy, input_natoms)
bias_atom_e = tmp[:, 0]
return {"bias_atom_e": bias_atom_e}
def init_fitting_stat(self, bias_atom_e=None, **kwargs):
assert all(x is not None for x in [bias_atom_e])
self.bias_atom_e.copy_(
torch.tensor(bias_atom_e, device=env.DEVICE).view(
[self.ntypes, self.dim_out]
)
)

Further Information, Files, and Links

No response

@njzjz
Copy link
Member

njzjz commented Mar 12, 2024

It seems that init_fitting_stat has been removed from the energy fitting (but it is still in BaseFitting). compute_output_stats is tested by source/tests/pt/test_stat.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants