# Flux Custom Loss Function Not Working Properly

**URL:** https://discourse.julialang.org/t/flux-custom-loss-function-not-working-properly/58090
**Category:** Machine Learning
**Tags:** flux, zygote
**Created:** [March 27, 2021, 7:36pm UTC](https://discourse.julialang.org/t/flux-custom-loss-function-not-working-properly/58090 "2021-03-27T19:36:03Z")
**Posts on this page:** 1
**Page:** 2

<div class="post-metadata">

### Author: ![maxfreu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxfreu/32/17468_2.png) [@maxfreu](https://discourse.julialang.org/u/maxfreu)
#### Post date: [April 2, 2021, 10:09am UTC](https://discourse.julialang.org/t/flux-custom-loss-function-not-working-properly/58090/21 "2021-04-02T10:09:21Z")

</div>

It is a convention that the optimizers always _minimize_ the target function. Therefore, in order to maximize the reward, you have to multiply it with -1.

[Previous page](https://discourse.julialang.org/t/flux-custom-loss-function-not-working-properly/58090.md?page=1)
