zhangxaochen
zhangxaochen

Reputation: 34017

Is 'tensorflow.negative' always the same as operator "-"?

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

Answers (1)

mujjiga
mujjiga

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

Related Questions