(self, backend: str = "auto")
Convert any constant operands to the correct backend form, and
        perform as many contractions as possible to create a new list of
        operands, stored in ``self._evaluated_constants[backend]``. This also
        makes sure ``self.contraction_list`` only contains the remaining,
        non-const operations.
Convert any constant operands to the correct backend form, and
        perform as many contractions as possible to create a new list of
        operands, stored in ``self._evaluated_constants[backend]``. This also
        makes sure ``self.contraction_list`` only contains the remaining,
        non-const operations.
Convert any constant operands to the correct backend form and perform as many contractions as possible to create a new list of operands stored in self . _evaluated_constants [ backend ] . This also makes sure self . contraction_list only contains the remaining non - const operations .
def evaluate_constants(self, backend: str = "auto") -> None:
        """Convert any constant operands to the correct backend form, and
        perform as many contractions as possible to create a new list of
        operands, stored in ``self._evaluated_constants[backend]``. This also
        makes sure ``self.contraction_list`` only contains the remaining,
        non-const operations.
        """
        # prepare a list of operands, with `None` for non-consts
        tmp_const_ops = [self._constants_dict.get(i, None) for i in range(self._full_num_args)]
        backend = parse_backend(tmp_const_ops, backend)

        # get the new list of operands with constant operations performed, and remaining contractions
        try:
            new_ops, new_contraction_list = backends.evaluate_constants(backend, tmp_const_ops, self)
        except KeyError:
            new_ops, new_contraction_list = self(*tmp_const_ops, backend=backend, evaluate_constants=True)

        self._evaluated_constants[backend] = new_ops
        self.contraction_list = new_contraction_list
def evaluate_constants ( self , backend : str = "auto" ) -> None : # prepare a list of operands, with `None` for non-consts tmp_const_ops = [ self . _constants_dict . get ( i , None ) for i in range ( self . _full_num_args ) ] backend = parse_backend ( tmp_const_ops , backend ) # get the new list of operands with constant operations performed, and remaining contractions try : new_ops , new_contraction_list = backends . evaluate_constants ( backend , tmp_const_ops , self ) except KeyError : new_ops , new_contraction_list = self ( * tmp_const_ops , backend = backend , evaluate_constants = True ) self . _evaluated_constants [ backend ] = new_ops self . contraction_list = new_contraction_list