Skip to content

Commit

Permalink
tf.accumulate_n -> tf.add_n (#2815)
Browse files Browse the repository at this point in the history
`tf.accumulate_n` has been deprecated, and from the source code, I see
that `tf.accumulate_n` is just a wrapper of `tf.add_n` since TF 2.1
(tensorflow/tensorflow@292d309).

See:
https://www.tensorflow.org/api_docs/python/tf/math/accumulate_n
https://www.tensorflow.org/api_docs/python/tf/math/add_n

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Sep 14, 2023
1 parent a8b3123 commit 58dd3e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deepmd/descriptor/se_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,8 +1054,8 @@ def _filter(
# add zero is meaningless; skip
rets.append(ret)
start_index += self.sel_a[type_i]
# faster to use accumulate_n than multiple add
xyz_scatter_1 = tf.accumulate_n(rets)
# faster to use add_n than multiple add
xyz_scatter_1 = tf.add_n(rets)
else:
xyz_scatter_1 = self._filter_lower(
type_i,
Expand Down

0 comments on commit 58dd3e2

Please sign in to comment.