Skip to content

Commit

Permalink
doubt -> dout
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed Oct 28, 2024
1 parent 33a54c2 commit 8d6fa49
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions source/tests/tf/test_descrpt_se_a_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def test_descriptor_se_a_mask(self):
is_training = tf.placeholder(tf.bool)
t_aparam = tf.placeholder(tf.int32, [None, None], name="i_aparam")

doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand All @@ -281,7 +281,7 @@ def test_descriptor_se_a_mask(self):
}
sess = self.cached_session().__enter__()
sess.run(tf.global_variables_initializer())
[op_dout] = sess.run([doubt], feed_dict=feed_dict_test)
[op_dout] = sess.run([dout], feed_dict=feed_dict_test)
op_dout = op_dout.reshape([-1])

ref_dout = np.zeros(op_dout.shape, dtype=float)
Expand Down
8 changes: 4 additions & 4 deletions source/tests/tf/test_descrpt_se_a_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_descriptor_two_sides(self):

type_embedding = typeebd.build(ntypes, suffix="_se_a_type_des_ebd_2sdies")

doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand All @@ -119,7 +119,7 @@ def test_descriptor_two_sides(self):

sess = self.cached_session().__enter__()
sess.run(tf.global_variables_initializer())
[model_dout] = sess.run([doubt], feed_dict=feed_dict_test)
[model_dout] = sess.run([dout], feed_dict=feed_dict_test)
model_dout = model_dout.reshape([-1])

ref_dout = [
Expand Down Expand Up @@ -257,7 +257,7 @@ def test_descriptor_one_side(self):

type_embedding = typeebd.build(ntypes, suffix="_se_a_type_des_ebd_1side")

doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand All @@ -284,7 +284,7 @@ def test_descriptor_one_side(self):

sess = self.cached_session().__enter__()
sess.run(tf.global_variables_initializer())
[model_dout] = sess.run([doubt], feed_dict=feed_dict_test)
[model_dout] = sess.run([dout], feed_dict=feed_dict_test)
model_dout = model_dout.reshape([-1])

ref_dout = [
Expand Down
16 changes: 8 additions & 8 deletions source/tests/tf/test_descrpt_se_atten.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_descriptor_two_sides(self):
+ "_se_atten_type_des_ebd_2sdies",
)

doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand Down Expand Up @@ -142,7 +142,7 @@ def test_descriptor_two_sides(self):

sess = self.cached_session().__enter__()
sess.run(tf.global_variables_initializer())
[model_dout] = sess.run([doubt], feed_dict=feed_dict_test)
[model_dout] = sess.run([dout], feed_dict=feed_dict_test)
model_dout = model_dout.reshape([-1])
np.savetxt("two.out", model_dout.reshape([1, -1]), delimiter=",")

Expand Down Expand Up @@ -290,7 +290,7 @@ def test_descriptor_one_side(self):
+ "_se_atten_type_des_ebd_1side",
)

doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand Down Expand Up @@ -320,7 +320,7 @@ def test_descriptor_one_side(self):

sess = self.cached_session().__enter__()
sess.run(tf.global_variables_initializer())
[model_dout] = sess.run([doubt], feed_dict=feed_dict_test)
[model_dout] = sess.run([dout], feed_dict=feed_dict_test)
model_dout = model_dout.reshape([-1])
np.savetxt("one.out", model_dout.reshape([1, -1]), delimiter=",")

Expand Down Expand Up @@ -464,7 +464,7 @@ def test_stripped_type_embedding_descriptor_two_sides(self):
ntypes, suffix=self.filename + "-" + inspect.stack()[0][3]
)

doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand All @@ -491,7 +491,7 @@ def test_stripped_type_embedding_descriptor_two_sides(self):

sess = self.cached_session().__enter__()
sess.run(tf.global_variables_initializer())
[model_dout] = sess.run([doubt], feed_dict=feed_dict_test)
[model_dout] = sess.run([dout], feed_dict=feed_dict_test)
model_dout = model_dout.reshape([-1])
np.savetxt("two1.out", model_dout.reshape([1, -1]), delimiter=",")

Expand Down Expand Up @@ -640,7 +640,7 @@ def test_compressible_descriptor_two_sides(self):
+ "_se_atten_type_des_ebd_2sdies",
)

doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand Down Expand Up @@ -670,7 +670,7 @@ def test_compressible_descriptor_two_sides(self):

sess = self.cached_session().__enter__()
sess.run(tf.global_variables_initializer())
[model_dout] = sess.run([doubt], feed_dict=feed_dict_test)
[model_dout] = sess.run([dout], feed_dict=feed_dict_test)
model_dout = model_dout.reshape([-1])
np.savetxt("two.out", model_dout.reshape([1, -1]), delimiter=",")

Expand Down
6 changes: 3 additions & 3 deletions source/tests/tf/test_descrpt_sea_ef_rot.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def build_efv(self, dcoord, dbox, dtype, tnatoms, name, op, reuse=None):
"uniform_seed": True,
}
)
doubt = descrpt.build(
dout = descrpt.build(
dcoord,
dtype,
tnatoms,
Expand All @@ -93,8 +93,8 @@ def build_efv(self, dcoord, dbox, dtype, tnatoms, name, op, reuse=None):
suffix=name,
reuse=reuse,
)
doubt = tf.reshape(doubt, [-1, descrpt.get_dim_out()])
atom_ener = tf.reduce_sum(doubt, axis=1)
dout = tf.reshape(dout, [-1, descrpt.get_dim_out()])
atom_ener = tf.reduce_sum(dout, axis=1)
atom_ener_reshape = tf.reshape(atom_ener, [-1, self.natoms[0]])
energy = tf.reduce_sum(atom_ener_reshape, axis=1)
force, virial, atom_vir = descrpt.prod_force_virial(atom_ener, tnatoms)
Expand Down
6 changes: 3 additions & 3 deletions source/tests/tf/test_fitting_dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_fitting(self):
is_training = tf.placeholder(tf.bool)
t_fparam = None

doubt = np.array(
dout = np.array(
[
0.0005722682145569174,
-0.00020202686217742682,
Expand Down Expand Up @@ -148,7 +148,7 @@ def test_fitting(self):

atype = np.array([0, 0, 1, 1, 1, 1], dtype=np.int32)

doubt = doubt.reshape([-1, 10])
dout = dout.reshape([-1, 10])
atype = atype.reshape([-1])

natoms = 6
Expand All @@ -158,7 +158,7 @@ def test_fitting(self):
test_data["atom_dos"] = tmp_atom_dos

atom_dos = fitting.build(
tf.convert_to_tensor(doubt),
tf.convert_to_tensor(dout),
t_natoms,
{
"atype": tf.convert_to_tensor(atype),
Expand Down
6 changes: 3 additions & 3 deletions source/tests/tf/test_fitting_ener_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_fitting(self):
is_training = tf.placeholder(tf.bool)
t_fparam = None

doubt = np.array(
dout = np.array(
[
0.0005722682145569174,
-0.00020202686217742682,
Expand Down Expand Up @@ -159,11 +159,11 @@ def test_fitting(self):
)
atype = np.array([0, 0, 1, 1, 1, 1], dtype=np.int32)

doubt = doubt.reshape([-1, 10])
dout = dout.reshape([-1, 10])
type_embedding = type_embedding.reshape([ntypes, -1])
atype = atype.reshape([-1])
atom_ener = fitting.build(
tf.convert_to_tensor(doubt),
tf.convert_to_tensor(dout),
t_natoms,
{
"type_embedding": tf.convert_to_tensor(type_embedding),
Expand Down
2 changes: 1 addition & 1 deletion source/tests/tf/test_model_se_a_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_model(self):
sess.run(tf.global_variables_initializer())
[e, f, v] = sess.run([energy, force, virial], feed_dict=feed_dict_test)
# print(sess.run(model.type_embedding))
# np.savetxt('tmp.out', sess.run(descrpt.doubt, feed_dict = feed_dict_test), fmt='%.10e')
# np.savetxt('tmp.out', sess.run(descrpt.dout, feed_dict = feed_dict_test), fmt='%.10e')
# # print(sess.run(model.atype_embed, feed_dict = feed_dict_test))
# print(sess.run(fitting.inputs, feed_dict = feed_dict_test))
# print(sess.run(fitting.outs, feed_dict = feed_dict_test))
Expand Down
18 changes: 9 additions & 9 deletions source/tests/tf/test_model_se_atten.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_model(self):
sess.run(tf.global_variables_initializer())
[e, f, v] = sess.run([energy, force, virial], feed_dict=feed_dict_test)
# print(sess.run(model.type_embedding))
# np.savetxt('tmp.out', sess.run(descrpt.doubt, feed_dict = feed_dict_test), fmt='%.10e')
# np.savetxt('tmp.out', sess.run(descrpt.dout, feed_dict = feed_dict_test), fmt='%.10e')
# # print(sess.run(model.atype_embed, feed_dict = feed_dict_test))
# print(sess.run(fitting.inputs, feed_dict = feed_dict_test))
# print(sess.run(fitting.outs, feed_dict = feed_dict_test))
Expand Down Expand Up @@ -239,7 +239,7 @@ def test_exclude_types(self):
type_embedding = typeebd.build(
ntypes, suffix=self.filename + "-" + inspect.stack()[0][3]
)
doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand All @@ -262,7 +262,7 @@ def test_exclude_types(self):

with self.cached_session() as sess:
sess.run(tf.global_variables_initializer())
[des] = sess.run([doubt], feed_dict=feed_dict_test1)
[des] = sess.run([dout], feed_dict=feed_dict_test1)

np.testing.assert_almost_equal(des[:, 0:2], 0.0, 10)
with self.assertRaises(AssertionError):
Expand Down Expand Up @@ -364,7 +364,7 @@ def test_compressible_model(self):
sess.run(tf.global_variables_initializer())
[e, f, v] = sess.run([energy, force, virial], feed_dict=feed_dict_test)
# print(sess.run(model.type_embedding))
# np.savetxt('tmp.out', sess.run(descrpt.doubt, feed_dict = feed_dict_test), fmt='%.10e')
# np.savetxt('tmp.out', sess.run(descrpt.dout, feed_dict = feed_dict_test), fmt='%.10e')
# # print(sess.run(model.atype_embed, feed_dict = feed_dict_test))
# print(sess.run(fitting.inputs, feed_dict = feed_dict_test))
# print(sess.run(fitting.outs, feed_dict = feed_dict_test))
Expand Down Expand Up @@ -468,7 +468,7 @@ def test_compressible_exclude_types(self):
type_embedding = typeebd.build(
ntypes, suffix=self.filename + "-" + inspect.stack()[0][3]
)
doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand All @@ -491,7 +491,7 @@ def test_compressible_exclude_types(self):

with self.cached_session() as sess:
sess.run(tf.global_variables_initializer())
[des] = sess.run([doubt], feed_dict=feed_dict_test1)
[des] = sess.run([dout], feed_dict=feed_dict_test1)

np.testing.assert_almost_equal(des[:, 0:2], 0.0, 10)
with self.assertRaises(AssertionError):
Expand Down Expand Up @@ -597,7 +597,7 @@ def test_stripped_type_embedding_model(self):
sess.run(tf.global_variables_initializer())
[e, f, v] = sess.run([energy, force, virial], feed_dict=feed_dict_test)
# print(sess.run(model.type_embedding))
# np.savetxt('tmp.out', sess.run(descrpt.doubt, feed_dict = feed_dict_test), fmt='%.10e')
# np.savetxt('tmp.out', sess.run(descrpt.dout, feed_dict = feed_dict_test), fmt='%.10e')
# # print(sess.run(model.atype_embed, feed_dict = feed_dict_test))
# print(sess.run(fitting.inputs, feed_dict = feed_dict_test))
# print(sess.run(fitting.outs, feed_dict = feed_dict_test))
Expand Down Expand Up @@ -703,7 +703,7 @@ def test_stripped_type_embedding_exclude_types(self):
ntypes,
suffix=self.filename + "-" + inspect.stack()[0][3] + "_type_embedding",
)
doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand All @@ -729,7 +729,7 @@ def test_stripped_type_embedding_exclude_types(self):

with self.cached_session() as sess:
sess.run(tf.global_variables_initializer())
[des] = sess.run([doubt], feed_dict=feed_dict_test1)
[des] = sess.run([dout], feed_dict=feed_dict_test1)

np.testing.assert_almost_equal(des[:, 0:2], 0.0, 10)
with self.assertRaises(AssertionError):
Expand Down

0 comments on commit 8d6fa49

Please sign in to comment.