# Doubts in Charecter level RNN tutorial

**URL:** <https://discuss.pytorch.org/t/doubts-in-charecter-level-rnn-tutorial/2189>\
**Category:** reinforcement-learning\
**Created:** [April 24, 2017, 12:16pm UTC](https://discuss.pytorch.org/t/doubts-in-charecter-level-rnn-tutorial/2189 "2017-04-24T12:16:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![VISHNU\_SUBRAMANIAN](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/vishnu_subramanian/32/293_2.png) [@VISHNU\_SUBRAMANIAN](https://discuss.pytorch.org/u/VISHNU_SUBRAMANIAN)\
**Post date:** [April 24, 2017, 12:16pm UTC](https://discuss.pytorch.org/t/doubts-in-charecter-level-rnn-tutorial/2189/1 "2017-04-24T12:16:20Z")

</div>

Hi I am going through PyTorch tutorial at

[http://pytorch.org/tutorials/intermediate/char\_rnn\_classification\_tutorial.html#training](http://pytorch.org/tutorials/intermediate/char_rnn_classification_tutorial.html#training).

Inside the train() function the network parameters are updated with gradients using the below line.

p.data.add\_(-learning\_rate, p.grad.data)

the add function I saw in the source code accepts only one argument. How does the function accepts 2 arguments and multiplies the learning rate with gradients and add that to the tensor data.

---

<div class="post-metadata">

**Author:** ![smth](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/smth/32/13_2.png) [@smth](https://discuss.pytorch.org/u/smth)\
**Post date:** [April 29, 2017, 2:56pm UTC](https://discuss.pytorch.org/t/doubts-in-charecter-level-rnn-tutorial/2189/2 "2017-04-29T14:56:06Z")

</div>

See the second signature of torch.add (there are two):

[http://pytorch.org/docs/torch.html#torch.add](http://pytorch.org/docs/torch.html#torch.add)

it does: y = y + alpha \* x
