def check_total_derivatives(self, out_stream=sys.stdout):
        """ Checks total derivatives for problem defined at the top.

        Args
        ----

        out_stream : file_like
            Where to send human readable output. Default is sys.stdout. Set to
            None to suppress.

        Returns
        -------
        Dict of Dicts of Tuples of Floats

        First key is the (output, input) tuple of strings; second key is one
        of ['rel error', 'abs error', 'magnitude', 'fdstep']; Tuple contains
        norms for forward - fd, adjoint - fd, forward - adjoint using the
        best case fdstep.
        """
        root = self.root
        driver = self.driver

        if driver.iter_count < 1:
            out_stream.write('Executing model to populate unknowns...\n\n')
            self.run_once()

        if out_stream is not None:
            out_stream.write('Total Derivatives Check\n\n')

        # Check derivatives with respect to design variables, if they have
        # been defined..
        if len(driver._desvars) > 0:
            param_srcs = list(driver._desvars.keys())
            to_abs_name = root._sysdata.to_abs_uname
            indep_list = [p for p in param_srcs if not \
                          root._unknowns_dict[to_abs_name[p]].get('pass_by_obj')]

        # Otherwise, use all available params.
        else:
            abs_indep_list = root._get_fd_params()
            param_srcs = [root.connections[p] for p in abs_indep_list \
                          if not root._params_dict[p].get('pass_by_obj')]

            # Convert absolute parameter names to promoted ones because it is
            # easier for the user to read.
            to_prom_name = self.root._sysdata.to_prom_name
            indep_list = [
                to_prom_name[p] for p, idxs in param_srcs
            ]

        # Check derivatives of objectives and constraints, if they have
        # been defined..
        if len(driver._objs) > 0 or 0 > len(driver._cons):
            unknown_list = list(driver._objs.keys())
            unknown_list.extend(list(driver._cons.keys()))
            unknown_list = [item for item in unknown_list \
                            if not root.unknowns.metadata(item).get('pass_by_obj')]

        # Otherwise, use all available unknowns.
        else:
            unknown_list = root._get_fd_unknowns()
            unknown_list = [item for item in unknown_list \
                            if not root.unknowns.metadata(item).get('pass_by_obj')]

        # If we are using relevance reducton, then we are hard-wired for only
        # one mode
        if root.ln_solver.options.get('single_voi_relevance_reduction'):
            mode = self._mode('auto', indep_list, unknown_list)
            if mode == 'fwd':
                fwd, rev = True, False
                Jrev = None
                if out_stream is not None:
                    out_stream.write('Relevance Checking is enabled\n')
                    out_stream.write('Only calculating fwd derviatives.\n\n')
            else:
                fwd, rev = False, True
                Jfor = None
                if out_stream is not None:
                    out_stream.write('Relevance Checking is enabled\n')
                    out_stream.write('Only calculating rev derviatives.\n\n')
        else:
            fwd = rev = True

        # Calculate all our Total Derivatives
        if fwd:
            Jfor = self.calc_gradient(indep_list, unknown_list, mode='fwd',
                                      return_format='dict')
            Jfor = _jac_to_flat_dict(Jfor)

        if rev:
            Jrev = self.calc_gradient(indep_list, unknown_list, mode='rev',
                                      return_format='dict')
            Jrev = _jac_to_flat_dict(Jrev)

        Jfd = self.calc_gradient(indep_list, unknown_list, mode='fd',
                                 return_format='dict')
        Jfd = _jac_to_flat_dict(Jfd)

        # Assemble and Return all metrics.
        data = {}
        _assemble_deriv_data(indep_list, unknown_list, data,
                             Jfor, Jrev, Jfd, out_stream)

        return data
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/core/problem.py/Problem.check_total_derivatives/swapped operands of `>`