# Differentiable argmax

**URL:** <https://discuss.pytorch.org/t/differentiable-argmax/33020>\
**Category:** Uncategorized\
**Created:** [December 25, 2018, 1:10pm UTC](https://discuss.pytorch.org/t/differentiable-argmax/33020 "2018-12-25T13:10:11Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![tom](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/tom/32/3162_2.png) [@tom](https://discuss.pytorch.org/u/tom)\
**Post date:** [December 25, 2018, 8:41pm UTC](https://discuss.pytorch.org/t/differentiable-argmax/33020/6 "2018-12-25T20:41:11Z")

</div>

> [@ram](#):
>
> My embedding layer should be outside of the function based on the architecture that I use.

If you use indexing / embedding, the index doesn’t have a gradient, so I can probably learn a trick if you share how you use the index when it works.

By “it doesn’t do gradients on the weight” I just meant that my function above won’t return gradients for the embedding\_matrix (weight in the embedding layer…), sorry for the confusion!

Best regards

Thomas

---

_[View the full topic](https://discuss.pytorch.org/t/differentiable-argmax/33020)._
