# Is there any different between torch.sigmoid and torch.nn.functional.sigmoid?

**URL:** <https://discuss.pytorch.org/t/is-there-any-different-between-torch-sigmoid-and-torch-nn-functional-sigmoid/995>\
**Category:** Uncategorized\
**Created:** [March 11, 2017, 7:14am UTC](https://discuss.pytorch.org/t/is-there-any-different-between-torch-sigmoid-and-torch-nn-functional-sigmoid/995 "2017-03-11T07:14:10Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![fmassa](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/fmassa/32/58_2.png) [@fmassa](https://discuss.pytorch.org/u/fmassa)\
**Post date:** [March 11, 2017, 10:58am UTC](https://discuss.pytorch.org/t/is-there-any-different-between-torch-sigmoid-and-torch-nn-functional-sigmoid/995/3 "2017-03-11T10:58:27Z")

</div>

Actually, there is a difference.  
The implementations in `torch.xxx` have the [backward implemented using `python` calls](https://github.com/pytorch/pytorch/blob/master/torch/autograd/_functions/pointwise.py#L70), while the functional counterparts have their backward implemented entirely in [C](https://github.com/pytorch/pytorch/blob/master/torch/lib/THNN/generic/Sigmoid.c#L28)/[Cuda](https://github.com/pytorch/pytorch/blob/master/torch/lib/THCUNN/Sigmoid.cu#L20), so the `functional` backward code is more efficient.

---

_[View the full topic](https://discuss.pytorch.org/t/is-there-any-different-between-torch-sigmoid-and-torch-nn-functional-sigmoid/995)._
