View source on GitHub |
Returns the cross product of two (arrays of) vectors.
tf.keras.ops.cross(
x1, x2, axisa=-1, axisb=-1, axisc=-1, axis=None
)
The cross product of x1
and x2
in R^3 is a vector
perpendicular to both x1
and x2
. If x1
and x2
are arrays of
vectors, the vectors are defined by the last axis of x1
and x2
by default, and these axes can have dimensions 2 or 3.
Where the dimension of either x1
or x2
is 2, the third component of
the input vector is assumed to be zero and the cross product calculated
accordingly.
In cases where both input vectors have dimension 2, the z-component of the cross product is returned.
Note | |
---|---|
Torch backend does not support two dimensional vectors, or the
arguments axisa , axisb and axisc . Use axis instead.
|
Returns | |
---|---|
Vector cross product(s). |