# Calculating sub- and super-gradients

**URL:** <https://discourse.julialang.org/t/calculating-sub-and-super-gradients/69306>\
**Category:** New to Julia\
**Tags:** differentiation\
**Created:** [October 6, 2021, 1:55pm UTC](https://discourse.julialang.org/t/calculating-sub-and-super-gradients/69306 "2021-10-06T13:55:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iHany](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihany/32/18151_2.png) [@iHany](https://discourse.julialang.org/u/iHany)\
**Post date:** [October 6, 2021, 1:55pm UTC](https://discourse.julialang.org/t/calculating-sub-and-super-gradients/69306/1 "2021-10-06T13:55:35Z")

</div>

Hi,

I’d like to know whether there is an easy way of getting sub- or super-gradients in Julia (auto-differentiation of non-differentiable functions…?).

Please share related packages 🙂 Thanks.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [October 6, 2021, 2:04pm UTC](https://discourse.julialang.org/t/calculating-sub-and-super-gradients/69306/2 "2021-10-06T14:04:56Z")

</div>

In general, most autodiff packages in Julia return sub-gradients.

---

<div class="post-metadata">

**Author:** ![iHany](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihany/32/18151_2.png) [@iHany](https://discourse.julialang.org/u/iHany)\
**Post date:** [October 6, 2021, 2:07pm UTC](https://discourse.julialang.org/t/calculating-sub-and-super-gradients/69306/3 "2021-10-06T14:07:34Z")

</div>

To be honest, I often use Flux.jl for auto-diff but I’m not aware of how it works internally.

Is there any reference where I can check that AD tools provide sub-gradients?

Also, how about super-gradients?  
 → oh, well, it would be possible to get super-gradients by flipping the sings of given function and its sub-gradient (a bit uncomfortable though).

Thanks
