einx.equal

Contents

einx.equal#

einx.equal(description, *tensors, backend=None, **parameters)[source]#

Computes the equality comparison between values of two given tensors.

The elementary operation takes two scalars as input and returns true if they are equal, otherwise false.

If there is no output expression, one of the input expressions is implicitly used as output expression if it contains the axis names of all other inputs and if this choice is unique. For example, the following pairs of operations compute the same output:

z = einx.equal("a b, a", x, y)
z = einx.equal("a b, a -> a b", x, y)

z = einx.equal("a b, a b", x, y)
z = einx.equal("a b, a b -> a b", x, y)

z = einx.equal("a b, b a", x, y)
# raises an exception due to ambiguous output expression
Parameters:
  • description (str) – Description string for the operation in einx notation.

  • *tensors (Tensor) – Input tensors or tensor factories matching the description string.

  • backend (Union[Backend, str, None]) – Backend to use for all operations. If None, uses the default backend for the given setting. Defaults to None.

  • graph – Whether to return the compiled code representation of this operation instead of computing the result. Defaults to False.

  • **parameters (Union[_Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[bool | int | float | complex | str | bytes]]) – Additional parameters that specify dimension sizes, e.g. a=4.

Return type:

Tensor

Returns:

The result of the operation if graph=False, otherwise the compiled code representation of the operation.