Returns the truth value of (x == y) element-wise. Usage: ```python x = tf.constant([2, 4]) y = tf.constant(2) tf.math.equal(x, y) ==> array([True, False]) x = tf.constant([2, 4]) y = tf.constant([2, 4]) tf.math.equal(x, y) ==> array([True, True]) ``` **NOTE**: `Equal` suppor
(x, y, name=None)
| 1278 | @tf_export("math.equal", "equal") |
| 1279 | @dispatch.add_dispatch_support |
| 1280 | def equal(x, y, name=None): |
| 1281 | """Returns the truth value of (x == y) element-wise. |
| 1282 | |
| 1283 | Usage: |
| 1284 | |
| 1285 | ```python |
| 1286 | x = tf.constant([2, 4]) |
| 1287 | y = tf.constant(2) |
| 1288 | tf.math.equal(x, y) ==> array([True, False]) |
| 1289 | |
| 1290 | x = tf.constant([2, 4]) |
| 1291 | y = tf.constant([2, 4]) |
| 1292 | tf.math.equal(x, y) ==> array([True, True]) |
| 1293 | ``` |
| 1294 | |
| 1295 | **NOTE**: `Equal` supports broadcasting. More about broadcasting [here]( |
| 1296 | https://docs.scipy.org/doc/numpy-1.13.0/user/basics.broadcasting.html) |
| 1297 | |
| 1298 | Args: |
| 1299 | x: A `Tensor` or `SparseTensor` or `IndexedSlices`. |
| 1300 | y: A `Tensor` or `SparseTensor` or `IndexedSlices`. |
| 1301 | name: A name for the operation (optional). |
| 1302 | |
| 1303 | Returns: |
| 1304 | A `Tensor` of type bool with the same size as that of x or y. |
| 1305 | """ |
| 1306 | return gen_math_ops.equal(x, y, name=name) |
| 1307 | |
| 1308 | |
| 1309 | @tf_export("math.not_equal", "not_equal") |