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(tf): prevent fitting_attr variable scope from becoming fitting_attr_1 #3930

Merged
merged 5 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion deepmd/tf/descriptor/se_a_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def build(
aparam[:, :] is the real/virtual sign for each atom.
"""
aparam = input_dict["aparam"]
with tf.variable_scope("fitting_attr" + suffix, reuse=reuse):
with tf.variable_scope("fitting_attr" + suffix, reuse=tf.AUTO_REUSE):
t_aparam_nall = tf.constant(True, name="aparam_nall", dtype=tf.bool)
njzjz marked this conversation as resolved.
Show resolved Hide resolved
self.mask = tf.cast(aparam, tf.int32)
self.mask = tf.reshape(self.mask, [-1, natoms[1]])
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/fit/dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def build(
if self.aparam_inv_std is None:
self.aparam_inv_std = 1.0

with tf.variable_scope("fitting_attr" + suffix, reuse=reuse):
with tf.variable_scope("fitting_attr" + suffix, reuse=tf.AUTO_REUSE):
t_dfparam = tf.constant(self.numb_fparam, name="dfparam", dtype=tf.int32)
t_daparam = tf.constant(self.numb_aparam, name="daparam", dtype=tf.int32)
t_numb_dos = tf.constant(self.numb_dos, name="numb_dos", dtype=tf.int32)
njzjz marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/fit/ener.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def build(
if "t_bias_atom_e" in nvnmd_cfg.weight.keys():
self.bias_atom_e = nvnmd_cfg.weight["t_bias_atom_e"]

with tf.variable_scope("fitting_attr" + suffix, reuse=reuse):
with tf.variable_scope("fitting_attr" + suffix, reuse=tf.AUTO_REUSE):
t_dfparam = tf.constant(self.numb_fparam, name="dfparam", dtype=tf.int32)
t_daparam = tf.constant(self.numb_aparam, name="daparam", dtype=tf.int32)
njzjz marked this conversation as resolved.
Show resolved Hide resolved
njzjz marked this conversation as resolved.
Show resolved Hide resolved
self.t_bias_atom_e = tf.get_variable(
Expand Down
Loading