# Zygote: meaning of @adjoint add(a, b) = add(a, b), Δ -\> (Δ, Δ)

**URL:** <https://discourse.julialang.org/t/zygote-meaning-of-adjoint-add-a-b-add-a-b/36707>\
**Category:** Machine Learning\
**Created:** [March 29, 2020, 11:17pm UTC](https://discourse.julialang.org/t/zygote-meaning-of-adjoint-add-a-b-add-a-b/36707 "2020-03-29T23:17:26Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![lhnguyen-vn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lhnguyen-vn/32/15449_2.png) [@lhnguyen-vn](https://discourse.julialang.org/u/lhnguyen-vn)\
**Post date:** [March 31, 2020, 10:43pm UTC](https://discourse.julialang.org/t/zygote-meaning-of-adjoint-add-a-b-add-a-b/36707/4 "2020-03-31T22:43:07Z")

</div>

1. `Δ -> (Δ, Δ)` is essentially defining \frac{\partial L}{\partial \text{add(a, b)}} \rightarrow \left( \frac{\partial L}{\partial \text{a}}, \frac{\partial L}{\partial \text{b}} \right). If we want to calculate the gradient of `add(a, b)` wrt to `a` and `b`, then `L` would be `add(a, b)` and `Δ` is therefore 1. Generally speaking, `gradient` is just syntatic sugar that will lower down to the adjoint and plug 1 in.
2. Defining the adjoint is the reason how Zygote knows the derivative! Substituting Δ with 1 gives you the derivatives (1, 1).

This example is rather trivial, but customizing the adjoint offers incredible flexibility. You can make Zygote work with your own data type, or use mathematical knowledge to aid automatic differentiation.

---

_[View the full topic](https://discourse.julialang.org/t/zygote-meaning-of-adjoint-add-a-b-add-a-b/36707)._
