-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathLogSoftmax.patch
More file actions
35 lines (30 loc) · 1.42 KB
/
LogSoftmax.patch
File metadata and controls
35 lines (30 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--- /home/michael/anaconda3/envs/py37/lib/python3.7/site-packages/torch/nn/modules/activation.py
+++ /home/michael/anaconda3/envs/py37/lib/python3.7/site-packages/torch/nn/modules/activation.py
@@ -1,17 +1,16 @@
class LogSoftmax(Module):
- r"""Applies the :math:`\log(\text{Softmax}(x))` function to an n-dimensional
- input Tensor. The LogSoftmax formulation can be simplified as:
+ r"""Applies the `Log(Softmax(x))` function to an n-dimensional input Tensor.
+ The LogSoftmax formulation can be simplified as
- .. math::
- \text{LogSoftmax}(x_{i}) = \log\left(\frac{\exp(x_i) }{ \sum_j \exp(x_j)} \right)
+ :math:`\text{LogSoftmax}(x_{i}) = \log\left(\frac{\exp(x_i) }{ \sum_j \exp(x_j)} \right)`
Shape:
- - Input: :math:`(*)` where `*` means, any number of additional
- dimensions
- - Output: :math:`(*)`, same shape as the input
+ - Input: any shape
+ - Output: same as input
Arguments:
- dim (int): A dimension along which LogSoftmax will be computed.
+ dim (int): A dimension along which Softmax will be computed (so every slice
+ along dim will sum to 1).
Returns:
a Tensor of the same dimension and shape as the input with
@@ -23,7 +22,6 @@
>>> input = torch.randn(2, 3)
>>> output = m(input)
"""
- __constants__ = ['dim']
def __init__(self, dim=None):
super(LogSoftmax, self).__init__()