(self, *arrays: ArrayType, **kwargs: Any)
Evaluate this expression with a set of arrays.

        Parameters
        ----------
        arrays : seq of array
            The arrays to supply as input to the expression.
        out : array, optional (default: ``None``)
            If specified, output the result into this array.
        backend : str, optional  (default: ``numpy``)
            Perform the contraction with this backend library. If numpy arrays
            are supplied then try to convert them to and from the correct
            backend array type.
Evaluate this expression with a set of arrays.
Evaluate this expression with a set of arrays .
def __call__(self, *arrays: ArrayType, **kwargs: Any) -> ArrayType:
        """Evaluate this expression with a set of arrays.

        Parameters
        ----------
        arrays : seq of array
            The arrays to supply as input to the expression.
        out : array, optional (default: ``None``)
            If specified, output the result into this array.
        backend : str, optional  (default: ``numpy``)
            Perform the contraction with this backend library. If numpy arrays
            are supplied then try to convert them to and from the correct
            backend array type.
        """
        out = kwargs.pop("out", None)
        backend = parse_backend(arrays, kwargs.pop("backend", "auto"))
        evaluate_constants = kwargs.pop("evaluate_constants", False)

        if kwargs:
            raise ValueError(
                "The only valid keyword arguments to a `ContractExpression` "
                "call are `out=` or `backend=`. Got: {}.".format(kwargs)
            )

        correct_num_args = self._full_num_args if evaluate_constants else self.num_args

        if len(arrays) != correct_num_args:
            raise ValueError(
                "This `ContractExpression` takes exactly {} array arguments "
                "but received {}.".format(self.num_args, len(arrays))
            )

        if self._constants_dict and not evaluate_constants:
            # fill in the missing non-constant terms with newly supplied arrays
            ops_var, ops_const = iter(arrays), self._get_evaluated_constants(backend)
            ops: Sequence[ArrayType] = [next(ops_var) if op is None else op for op in ops_const]
        else:
            ops = arrays

        try:
            # Check if the backend requires special preparation / calling
            #   but also ignore non-numpy arrays -> assume user wants same type back
            if backends.has_backend(backend) and all(infer_backend(x) == "numpy" for x in arrays):
                return self._contract_with_conversion(ops, out, backend, evaluate_constants=evaluate_constants)

            return self._contract(ops, out, backend, evaluate_constants=evaluate_constants)

        except ValueError as err:
            original_msg = str(err.args) if err.args else ""
            msg = (
                "Internal error while evaluating `ContractExpression`. Note that few checks are performed"
                " - the number and rank of the array arguments must match the original expression. "
                "The internal error was: '{}'".format(original_msg),
            )
            err.args = msg
            raise
def __call__ ( self , * arrays : ArrayType , * * kwargs : Any ) -> ArrayType : out = kwargs . pop ( "out" , None ) backend = parse_backend ( arrays , kwargs . pop ( "backend" , "auto" ) ) evaluate_constants = kwargs . pop ( "evaluate_constants" , False ) if kwargs : raise ValueError ( "The only valid keyword arguments to a `ContractExpression` " "call are `out=` or `backend=`. Got: {}." . format ( kwargs ) ) correct_num_args = self . _full_num_args if evaluate_constants else self . num_args if len ( arrays ) != correct_num_args : raise ValueError ( "This `ContractExpression` takes exactly {} array arguments " "but received {}." . format ( self . num_args , len ( arrays ) ) ) if self . _constants_dict and not evaluate_constants : # fill in the missing non-constant terms with newly supplied arrays ops_var , ops_const = iter ( arrays ) , self . _get_evaluated_constants ( backend ) ops : Sequence [ ArrayType ] = [ next ( ops_var ) if op is None else op for op in ops_const ] else : ops = arrays try : # Check if the backend requires special preparation / calling #   but also ignore non-numpy arrays -> assume user wants same type back if backends . has_backend ( backend ) and all ( infer_backend ( x ) == "numpy" for x in arrays ) : return self . _contract_with_conversion ( ops , out , backend , evaluate_constants = evaluate_constants ) return self . _contract ( ops , out , backend , evaluate_constants = evaluate_constants ) except ValueError as err : original_msg = str ( err . args ) if err . args else "" msg = ( "Internal error while evaluating `ContractExpression`. Note that few checks are performed" " - the number and rank of the array arguments must match the original expression. " "The internal error was: '{}'" . format ( original_msg ) , ) err . args = msg raise