BeeperTeeper
BeeperTeeper

Reputation: 161

Are partial derivatives ever calculated in reverse mode?

I understand that openMDAO can compute the total derivatives of a model in forward or reverse mode, but are partial derivatives always calculated in forward mode?

For example, I have a component with 400 inputs and 4 outputs. Obviously, this is a candidate for a reverse-mode solve. If I just declare_partials(['*'], ['*'], method=fd), will openMDAO ever attempt to solve this in reverse mode?

Upvotes: 0

Views: 110

Answers (2)

Justin Gray
Justin Gray

Reputation: 5710

When you differentiate things with FD or CS, you're using forward mode by definition.

When you differentiate things by hand (i.e. pen and paper, derive the partials, then code them up) concept of forward mode or reverse mode doesn't really apply.

However, if you use Algorithmic Differentiation to compute your partials then you absolutely can choose forward or reverse mode AD. If you had 400 inputs and 4 outputs, the reverse mode AD would be faster.

Upvotes: 1

Kenneth Moore
Kenneth Moore

Reputation: 2202

Reverse mode approximated partials aren't going to work. When you perform finite difference, you increment an input by a small amount, and then call compute to compute the outputs. In order to do this in reverse mode, you would need to be able to run your component "backwards" giving it outputs to produce the inputs.

So the answer is: OpenMDAO always compute approximated partials in forward mode.

If your component is slow in fd, this might be a good candidate for declaring analytic derivatives.

Upvotes: 2

Related Questions