diff --git a/deepmd/tf/descriptor/se_a_mask.py b/deepmd/tf/descriptor/se_a_mask.py index b79e806fca..d9891cf0da 100644 --- a/deepmd/tf/descriptor/se_a_mask.py +++ b/deepmd/tf/descriptor/se_a_mask.py @@ -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) self.mask = tf.cast(aparam, tf.int32) self.mask = tf.reshape(self.mask, [-1, natoms[1]]) diff --git a/deepmd/tf/fit/dos.py b/deepmd/tf/fit/dos.py index 382d11f45e..928c8f5b32 100644 --- a/deepmd/tf/fit/dos.py +++ b/deepmd/tf/fit/dos.py @@ -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) diff --git a/deepmd/tf/fit/ener.py b/deepmd/tf/fit/ener.py index c2aef0610a..8e856bada4 100644 --- a/deepmd/tf/fit/ener.py +++ b/deepmd/tf/fit/ener.py @@ -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) self.t_bias_atom_e = tf.get_variable(