Reputation: 34017
I see some tensorflow functions which do element-wise operations: reduce_sum
, add
, negative
, etc.
e.g. this code:
import tensorflow as tf
distance = tf.reduce_sum(tf.abs(tf.add(xtr, tf.negative(xte))), reduction_indices=1)
When I try using the following code instead, I found they have the same effect:
distance = tf.reduce_sum(tf.abs(xtr-xte), reduction_indices=1)
So I'm wondering:
1, Whether add
, negative
, multiply
can always being replaced by +
, -
, *
? If NOT, can u give me some exceptive examples?
2, Also, how can I list ALL the functions that have corresponding operators?
Upvotes: 1
Views: 263
Reputation: 16856
Yes you can always replace them with corresponding operator.
Check this question for full list
In tensorflow what is the difference between tf.add and operator (+)?
Upvotes: 1