tf.math.add_n
bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
Adds all input tensors element-wise.
View aliases
Main aliases
tf.add_n
Compat aliases for migration
See
Migration guide for
more details.
tf.compat.v1.add_n
, tf.compat.v1.math.add_n
tf.math.add_n(
inputs, name=None
)
tf.math.add_n
performs the same operation as tf.math.accumulate_n
.
This op does not broadcast
its inputs. If you need broadcasting, use tf.math.add
(or the +
operator)
instead.
For example:
a = tf.constant([[3, 5], [4, 8]])
b = tf.constant([[1, 6], [2, 9]])
tf.math.add_n([a, b, a])
<tf.Tensor: shape=(2, 2), dtype=int32, numpy=
array([[ 7, 16],
[10, 25]], dtype=int32)>
Args |
inputs
|
A list of tf.Tensor or tf.IndexedSlices objects, each with the
same shape and type. tf.IndexedSlices objects will be converted into
dense tensors prior to adding.
|
name
|
A name for the operation (optional).
|
Returns |
A tf.Tensor of the same shape and type as the elements of inputs .
|
Raises |
ValueError
|
If inputs don't all have same shape and dtype or the shape
cannot be inferred.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2022-11-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-11-04 UTC."],[],[]]