Maximize a cost function

In the optim class, we always call optimizer.step() which I assume computes the loss after a minimization process. If we want to maximize a cost function, do we simply negate optimizer.step()?

You negate your loss function, and you should be fine


It’s a None object. Isn’t it?