Join the newly launched Discord
community for real-time discussions, peer support, and direct interaction with the Meridian team!
meridian.backend.equal
Stay organized with collections
Save and categorize content based on your preferences.
Returns the truth value of (x == y) element-wise.
meridian
.
backend
.
equal
(
x
,
y
,
name
=
None
)
Performs a broadcast
with the
arguments and then an element-wise equality comparison, returning a Tensor of
boolean values.
For example:
>>>
x
=
tf
.
constant
([
2
,
4
])
>>>
y
=
tf
.
constant
(
2
)
>>>
tf
.
math
.
equal
(
x
,
y
)
< tf
.
Tensor
:
shape
=
(
2
,),
dtype
=
bool
,
numpy
=
array
([
True
,
False
])
>
>>>
x
=
tf
.
constant
([
2
,
4
])
>>>
y
=
tf
.
constant
([
2
,
4
])
>>>
tf
.
math
.
equal
(
x
,
y
)
< tf
.
Tensor
:
shape
=
(
2
,),
dtype
=
bool
,
numpy
=
array
([
True
,
True
])
>
A name for the operation (optional).
A tf.Tensor
of type bool with the same size as that of x or y.
tf.errors.InvalidArgumentError
: If shapes of arguments are incompatible
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.
Last updated 2025-08-22 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 2025-08-22 UTC."],[],[],null,["# meridian.backend.equal\n\n\u003cbr /\u003e\n\nReturns the truth value of (x == y) element-wise. \n\n meridian.backend.equal(\n x, y, name=None\n )\n\nPerforms a [broadcast](https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) with the\narguments and then an element-wise equality comparison, returning a Tensor of\nboolean values.\n\n#### For example:\n\n \u003e\u003e\u003e x = tf.constant([2, 4])\n \u003e\u003e\u003e y = tf.constant(2)\n \u003e\u003e\u003e tf.math.equal(x, y)\n \u003ctf.Tensor: shape=(2,), dtype=bool, numpy=array([ True, False])\u003e\n\n \u003e\u003e\u003e x = tf.constant([2, 4])\n \u003e\u003e\u003e y = tf.constant([2, 4])\n \u003e\u003e\u003e tf.math.equal(x, y)\n \u003ctf.Tensor: shape=(2,), dtype=bool, numpy=array([ True, True])\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------|--------------------------------------|\n| `x` | A `tf.Tensor`. |\n| `y` | A `tf.Tensor`. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `tf.Tensor` of type bool with the same size as that of x or y. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|---|---|\n| `tf.errors.InvalidArgumentError`: If shapes of arguments are incompatible ||\n\n\u003cbr /\u003e"]]