def check_partial_derivatives(self, out_stream=sys.stdout, comps=None,
                                  compact_print=False):
        """ Checks partial derivatives comprehensively for all components in
        your model.

        Args
        ----

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

        comps : None or list_like
            List of component names to check the partials of (all others will be skipped).
            Set to None (default) to run all components

        compact_print : bool
            Set to True to just print the essentials, one line per unknown-param
            pair.

        Returns
        -------
        Dict of Dicts of Dicts

        First key is the component name;
        2nd key is the (output, input) tuple of strings;
        third key is one of ['rel error', 'abs error', 'magnitude', 'J_fd', 'J_fwd', 'J_rev'];

        For 'rel error', 'abs error', 'magnitude' the value is:

            A tuple containing norms for forward - fd, adjoint - fd, forward - adjoint using the best case fdstep

        For 'J_fd', 'J_fwd', 'J_rev' the value is:

            A numpy array representing the computed Jacobian for the three different methods of computation

        """

        root = self.root

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

        # Linearize the model
        root._sys_linearize(root.params, root.unknowns, root.resids)

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

        data = {}

        # Derivatives should just be checked without parallel adjoint for now.
        voi = None

        # Check derivative calculations for all comps at every level of the
        # system hierarchy.
        allcomps = root.components(recurse=True)
        if comps is None:
            comps = allcomps
        else:
            allcompnames = set([c.pathname for c in allcomps])
            requested = set(comps)
            diff = requested.difference(allcompnames)

            if diff:
                sorted_diff = list(diff)
                sorted_diff.sort()
                msg = "The following are not valid comp names: "
                msg += str(sorted_diff)
                raise RuntimeError(msg)

            comps = [root._subsystem(c_name) for c_name in comps]

        for comp in comps:
            cname = comp.pathname
            opt = comp.fd_options

            fwd_rev = True
            if opt['extra_check_partials_form']:
                f_d_2 = True
                fd_desc = opt['form']
                fd_desc2 = opt['extra_check_partials_form']
            else:
                f_d_2 = False
                fd_desc = None
                fd_desc2 = None

            # If we don't have analytic, then only continue if we are
            # comparing 2 different fds.
            if opt['force_fd']:
                if not f_d_2:
                    continue
                fwd_rev = False

            # IndepVarComps are just clutter too.
            if isinstance(comp, IndepVarComp):
                continue

            data[cname] = {}
            jac_fwd = OrderedDict()
            jac_rev = OrderedDict()
            jac_fd = OrderedDict()
            jac_fd2 = OrderedDict()

            params = comp.params
            unknowns = comp.unknowns
            resids = comp.resids
            dparams = comp.dpmat[voi]
            dunknowns = comp.dumat[voi]
            dresids = comp.drmat[voi]
            states = comp.states

            # Skip if all of our inputs are unconnected.
            if len(dparams) == 0:
                continue

            # Work with all params that are not pbo.
            param_list = [item for item in dparams if not \
                          dparams.metadata(item).get('pass_by_obj')]
            param_list.extend(states)
            unkn_list = [item for item in dunknowns if not \
                         dunknowns.metadata(item).get('pass_by_obj')]

            if out_stream is not None:
                out_stream.write('-'*(len(cname)+15) + '\n')
                out_stream.write("Component: '%s'\n" % cname)
                out_stream.write('-'*(len(cname)+15) + '\n')

            # Create all our keys and allocate Jacs
            for p_name in param_list:

                # No need to pre-allocate if we are not calculating them
                if not fwd_rev:
                    break

                dinputs = dunknowns if p_name in states else dparams
                p_size = np.size(dinputs[p_name])

                # Check dimensions of user-supplied Jacobian
                for u_name in unkn_list:

                    u_size = np.size(dunknowns[u_name])
                    if comp._jacobian_cache:

                        # We can perform some additional helpful checks.
                        if (u_name, p_name) in comp._jacobian_cache:

                            user = comp._jacobian_cache[(u_name, p_name)].shape

                            # User may use floats for scalar jacobians
                            if len(user) < 2:
                                user = (user[0], 1)

                            if user[0] != u_size or user[1] != p_size:
                                msg = "derivative in component '{}' of '{}' wrt '{}' is the wrong size. " + \
                                      "It should be {}, but got {}"
                                msg = msg.format(cname, u_name, p_name, (u_size, p_size), user)
                                raise ValueError(msg)

                    jac_fwd[(u_name, p_name)] = np.zeros((u_size, p_size))
                    jac_rev[(u_name, p_name)] = np.zeros((u_size, p_size))

            # Reverse derivatives first
            if fwd_rev:
                for u_name in unkn_list:
                    u_size = np.size(dunknowns[u_name])

                    # Send columns of identity
                    for idx in range(u_size):
                        dresids.vec[:] = 0.0
                        root.clear_dparams()
                        dunknowns.vec[:] = 0.0

                        dresids._dat[u_name].val[idx] = 1.0
                        try:
                            comp.apply_linear(params, unknowns, dparams,
                                              dunknowns, dresids, 'rev')
                        finally:
                            dparams._apply_unit_derivatives()

                        for p_name in param_list:

                            dinputs = dunknowns if p_name in states else dparams
                            jac_rev[(u_name, p_name)][idx, :] = dinputs._dat[p_name].val

            # Forward derivatives second
            if fwd_rev:
                for p_name in param_list:

                    dinputs = dunknowns if states in p_name else dparams
                    p_size = np.size(dinputs[p_name])

                    # Send columns of identity
                    for idx in range(p_size):
                        dresids.vec[:] = 0.0
                        root.clear_dparams()
                        dunknowns.vec[:] = 0.0

                        dinputs._dat[p_name].val[idx] = 1.0
                        dparams._apply_unit_derivatives()
                        comp.apply_linear(params, unknowns, dparams,
                                          dunknowns, dresids, 'fwd')

                        for u_name, u_val in dresids.vec_val_iter():
                            jac_fwd[(u_name, p_name)][:, idx] = u_val

            # Finite Difference goes last
            dresids.vec[:] = 0.0
            root.clear_dparams()
            dunknowns.vec[:] = 0.0

            # Component can request to use complex step.
            if opt['form'] == 'complex_step':
                fd_func = comp.complex_step_jacobian
            else:
                fd_func = comp.fd_jacobian

            jac_fd = fd_func(params, unknowns, resids)

            # Extra Finite Difference if requested
            if f_d_2:
                dresids.vec[:] = 0.0
                root.clear_dparams()
                dunknowns.vec[:] = 0.0

                # Component can request to use complex step.
                if opt['extra_check_partials_form'] == 'complex_step':
                    fd_func = comp.complex_step_jacobian
                else:
                    fd_func = comp.fd_jacobian

                # Cache old form so we can overide temporarily
                save_form = opt['form']
                OptionsDictionary.locked = False
                opt['form'] = opt['extra_check_partials_form']

                jac_fd2 = fd_func(params, unknowns, resids)

                opt['form'] = save_form
                OptionsDictionary.locked = True

            # Assemble and Return all metrics.
            _assemble_deriv_data(chain(dparams, states), resids, data[cname],
                                 jac_fwd, jac_rev, jac_fd, out_stream,
                                 c_name=cname, jac_fd2=jac_fd2, fd_desc=fd_desc,
                                 fd_desc2=fd_desc2, compact_print=compact_print)

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