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

fix(pt): fix get_dim for DescrptDPA1Compat #4007

Merged
merged 5 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
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
17 changes: 16 additions & 1 deletion deepmd/tf/descriptor/se_atten.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,14 @@
type_embedding=type_embedding,
atype=atype,
)
layer = tf.reshape(layer, [tf.shape(inputs)[0], natoms[0], self.get_dim_out()])
layer = tf.reshape(

Check warning on line 768 in deepmd/tf/descriptor/se_atten.py

View check run for this annotation

Codecov / codecov/patch

deepmd/tf/descriptor/se_atten.py#L768

Added line #L768 was not covered by tests
layer,
[
tf.shape(inputs)[0],
natoms[0],
self.filter_neuron[-1] * self.n_axis_neuron,
],
)
qmat = tf.reshape(
qmat, [tf.shape(inputs)[0], natoms[0], self.get_dim_rot_mat_1() * 3]
)
Expand Down Expand Up @@ -2194,6 +2201,14 @@
else:
self.embd_input_dim = 1

def get_dim_out(self) -> int:
"""Returns the output dimension of this descriptor."""
return (

Check warning on line 2206 in deepmd/tf/descriptor/se_atten.py

View check run for this annotation

Codecov / codecov/patch

deepmd/tf/descriptor/se_atten.py#L2206

Added line #L2206 was not covered by tests
super().get_dim_out() + self.tebd_dim
if self.concat_output_tebd
else super().get_dim_out()
)

def build(
self,
coord_: tf.Tensor,
Expand Down
2 changes: 2 additions & 0 deletions source/tests/consistent/descriptor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def build_tf_descriptor(self, obj, natoms, coords, atype, box, suffix):
{},
suffix=suffix,
)
# ensure get_dim_out gives the correct shape
t_des = tf.reshape(t_des, [1, natoms[0], obj.get_dim_out()])
return [t_des], {
t_coord: coords,
t_type: atype,
Expand Down