neulab/docprompting-conala huggingface dataset:
class torch.nn.quantized.InstanceNorm2d(num_features, weight, bias, scale, zero_point, eps=1e-05, momentum=0.1, affine=False, track_running_stats=False) [source]
 
This is the quantized version of InstanceNorm2d.  Additional args:

 
scale - quantization scale of the output, type: double. 
zero_point - quantization zero point of the output, type: long.
class torch.nn.quantized.InstanceNorm3d(num_features, weight, bias, scale, zero_point, eps=1e-05, momentum=0.1, affine=False, track_running_stats=False) [source]
 
This is the quantized version of InstanceNorm3d.  Additional args:

 
scale - quantization scale of the output, type: double. 
zero_point - quantization zero point of the output, type: long.
class torch.nn.quantized.LayerNorm(normalized_shape, weight, bias, scale, zero_point, eps=1e-05, elementwise_affine=True) [source]
 
This is the quantized version of LayerNorm.  Additional args:

 
scale - quantization scale of the output, type: double. 
zero_point - quantization zero point of the output, type: long.
class torch.nn.quantized.Linear(in_features, out_features, bias_=True, dtype=torch.qint8) [source]
 
A quantized linear module with quantized tensor as inputs and outputs. We adopt the same interface as torch.nn.Linear, please see https://pytorch.org/docs/stable/nn.html#torch.nn.Linear for documentation. Similar to Linear, attributes will be randomly initialized at module creation time and will be overwritten later  Variables 
 
~Linear.weight (Tensor) – the non-learnable quantized weights of the module of shape (out_features,in_features)(\text{out\_features}, \text{in\_features}) . 
~Linear.bias (Tensor) – the non-learnable bias of the module of shape (out_features)(\text{out\_features}) . If bias is True, the values are initialized to zero. 
~Linear.scale – scale parameter of output Quantized Tensor, type: double 
~Linear.zero_point – zero_point parameter for output Quantized Tensor, type: long    Examples: >>> m = nn.quantized.Linear(20, 30)
>>> input = torch.randn(128, 20)
>>> input = torch.quantize_per_tensor(input, 1.0, 0, torch.quint8)
>>> output = m(input)
>>> print(output.size())
torch.Size([128, 30])
  
classmethod from_float(mod) [source]
 
Create a quantized module from a float module or qparams_dict  Parameters 
mod (Module) – a float module, either produced by torch.quantization utilities or provided by the user
classmethod from_float(mod) [source]
 
Create a quantized module from a float module or qparams_dict  Parameters 
mod (Module) – a float module, either produced by torch.quantization utilities or provided by the user
class torch.nn.quantized.QFunctional [source]
 
Wrapper class for quantized operations. The instance of this class can be used instead of the torch.ops.quantized prefix. See example usage below.  Note This class does not provide a forward hook. Instead, you must use one of the underlying functions (e.g. add).  Examples: >>> q_add = QFunctional()
>>> a = torch.quantize_per_tensor(torch.tensor(3.0), 1.0, 0, torch.qint32)
>>> b = torch.quantize_per_tensor(torch.tensor(4.0), 1.0, 0, torch.qint32)
>>> q_add.add(a, b)  # Equivalent to ``torch.ops.quantized.add(a, b, 1.0, 0)``
  Valid operation names:

 add cat mul add_relu add_scalar mul_scalar
class torch.nn.quantized.Quantize(scale, zero_point, dtype) [source]
 
Quantizes an incoming tensor  Parameters 
 
scale – scale of the output Quantized Tensor 
zero_point – zero_point of output Quantized Tensor 
dtype – data type of output Quantized Tensor   Variables 
zero_point, dtype (`scale`,) –     Examples::

>>> t = torch.tensor([[1., -1.], [1., -1.]])
>>> scale, zero_point, dtype = 1.0, 2, torch.qint8
>>> qm = Quantize(scale, zero_point, dtype)
>>> qt = qm(t)
>>> print(qt)
tensor([[ 1., -1.],
        [ 1., -1.]], size=(2, 2), dtype=torch.qint8, scale=1.0, zero_point=2)
class torch.nn.quantized.ReLU6(inplace=False) [source]
 
Applies the element-wise function: ReLU6(x)=min⁡(max⁡(x0,x),q(6))\text{ReLU6}(x) = \min(\max(x_0, x), q(6)) , where x0x_0  is the zero_point, and q(6)q(6)  is the quantized representation of number 6.  Parameters 
inplace – can optionally do the operation in-place. Default: False    Shape:

 Input: (N,∗)(N, *)  where * means, any number of additional dimensions Output: (N,∗)(N, *) , same shape as the input     Examples: >>> m = nn.quantized.ReLU6()
>>> input = torch.randn(2)
>>> input = torch.quantize_per_tensor(input, 1.0, 0, dtype=torch.qint32)
>>> output = m(input)
class torch.nn.ReflectionPad1d(padding) [source]
 
Pads the input tensor using the reflection of the input boundary. For N-dimensional padding, use torch.nn.functional.pad().  Parameters 
padding (int, tuple) – the size of the padding. If is int, uses the same padding in all boundaries. If a 2-tuple, uses (padding_left\text{padding\_left} , padding_right\text{padding\_right} )    Shape:

 Input: (N,C,Win)(N, C, W_{in}) 
 
Output: (N,C,Wout)(N, C, W_{out})  where Wout=Win+padding_left+padding_rightW_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}      Examples: >>> m = nn.ReflectionPad1d(2)
>>> input = torch.arange(8, dtype=torch.float).reshape(1, 2, 4)
>>> input
tensor([[[0., 1., 2., 3.],
         [4., 5., 6., 7.]]])
>>> m(input)
tensor([[[2., 1., 0., 1., 2., 3., 2., 1.],
         [6., 5., 4., 5., 6., 7., 6., 5.]]])
>>> # using different paddings for different sides
>>> m = nn.ReflectionPad1d((3, 1))
>>> m(input)
tensor([[[3., 2., 1., 0., 1., 2., 3., 2.],
         [7., 6., 5., 4., 5., 6., 7., 6.]]])
class torch.nn.ReflectionPad2d(padding) [source]
 
Pads the input tensor using the reflection of the input boundary. For N-dimensional padding, use torch.nn.functional.pad().  Parameters 
padding (int, tuple) – the size of the padding. If is int, uses the same padding in all boundaries. If a 4-tuple, uses (padding_left\text{padding\_left} , padding_right\text{padding\_right} , padding_top\text{padding\_top} , padding_bottom\text{padding\_bottom} )    Shape:

 Input: (N,C,Hin,Win)(N, C, H_{in}, W_{in}) 
 
Output: (N,C,Hout,Wout)(N, C, H_{out}, W_{out})  where Hout=Hin+padding_top+padding_bottomH_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}  Wout=Win+padding_left+padding_rightW_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}      Examples: >>> m = nn.ReflectionPad2d(2)
>>> input = torch.arange(9, dtype=torch.float).reshape(1, 1, 3, 3)
>>> input
tensor([[[[0., 1., 2.],
          [3., 4., 5.],
          [6., 7., 8.]]]])
>>> m(input)
tensor([[[[8., 7., 6., 7., 8., 7., 6.],
          [5., 4., 3., 4., 5., 4., 3.],
          [2., 1., 0., 1., 2., 1., 0.],
          [5., 4., 3., 4., 5., 4., 3.],
          [8., 7., 6., 7., 8., 7., 6.],
          [5., 4., 3., 4., 5., 4., 3.],
          [2., 1., 0., 1., 2., 1., 0.]]]])
>>> # using different paddings for different sides
>>> m = nn.ReflectionPad2d((1, 1, 2, 0))
>>> m(input)
tensor([[[[7., 6., 7., 8., 7.],
          [4., 3., 4., 5., 4.],
          [1., 0., 1., 2., 1.],
          [4., 3., 4., 5., 4.],
          [7., 6., 7., 8., 7.]]]])
class torch.nn.ReLU(inplace=False) [source]
 
Applies the rectified linear unit function element-wise: ReLU(x)=(x)+=max⁡(0,x)\text{ReLU}(x) = (x)^+ = \max(0, x)   Parameters 
inplace – can optionally do the operation in-place. Default: False    Shape:

 Input: (N,∗)(N, *)  where * means, any number of additional dimensions Output: (N,∗)(N, *) , same shape as the input     Examples:   >>> m = nn.ReLU()
  >>> input = torch.randn(2)
  >>> output = m(input)


An implementation of CReLU - https://arxiv.org/abs/1603.05201

  >>> m = nn.ReLU()
  >>> input = torch.randn(2).unsqueeze(0)
  >>> output = torch.cat((m(input),m(-input)))
class torch.nn.ReLU6(inplace=False) [source]
 
Applies the element-wise function:  ReLU6(x)=min⁡(max⁡(0,x),6)\text{ReLU6}(x) = \min(\max(0,x), 6)  
 Parameters 
inplace – can optionally do the operation in-place. Default: False    Shape:

 Input: (N,∗)(N, *)  where * means, any number of additional dimensions Output: (N,∗)(N, *) , same shape as the input     Examples: >>> m = nn.ReLU6()
>>> input = torch.randn(2)
>>> output = m(input)
class torch.nn.ReplicationPad1d(padding) [source]
 
Pads the input tensor using replication of the input boundary. For N-dimensional padding, use torch.nn.functional.pad().  Parameters 
padding (int, tuple) – the size of the padding. If is int, uses the same padding in all boundaries. If a 2-tuple, uses (padding_left\text{padding\_left} , padding_right\text{padding\_right} )    Shape:

 Input: (N,C,Win)(N, C, W_{in}) 
 
Output: (N,C,Wout)(N, C, W_{out})  where Wout=Win+padding_left+padding_rightW_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}      Examples: >>> m = nn.ReplicationPad1d(2)
>>> input = torch.arange(8, dtype=torch.float).reshape(1, 2, 4)
>>> input
tensor([[[0., 1., 2., 3.],
         [4., 5., 6., 7.]]])
>>> m(input)
tensor([[[0., 0., 0., 1., 2., 3., 3., 3.],
         [4., 4., 4., 5., 6., 7., 7., 7.]]])
>>> # using different paddings for different sides
>>> m = nn.ReplicationPad1d((3, 1))
>>> m(input)
tensor([[[0., 0., 0., 0., 1., 2., 3., 3.],
         [4., 4., 4., 4., 5., 6., 7., 7.]]])
class torch.nn.ReplicationPad2d(padding) [source]
 
Pads the input tensor using replication of the input boundary. For N-dimensional padding, use torch.nn.functional.pad().  Parameters 
padding (int, tuple) – the size of the padding. If is int, uses the same padding in all boundaries. If a 4-tuple, uses (padding_left\text{padding\_left} , padding_right\text{padding\_right} , padding_top\text{padding\_top} , padding_bottom\text{padding\_bottom} )    Shape:

 Input: (N,C,Hin,Win)(N, C, H_{in}, W_{in}) 
 
Output: (N,C,Hout,Wout)(N, C, H_{out}, W_{out})  where Hout=Hin+padding_top+padding_bottomH_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}  Wout=Win+padding_left+padding_rightW_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}      Examples: >>> m = nn.ReplicationPad2d(2)
>>> input = torch.arange(9, dtype=torch.float).reshape(1, 1, 3, 3)
>>> input
tensor([[[[0., 1., 2.],
          [3., 4., 5.],
          [6., 7., 8.]]]])
>>> m(input)
tensor([[[[0., 0., 0., 1., 2., 2., 2.],
          [0., 0., 0., 1., 2., 2., 2.],
          [0., 0., 0., 1., 2., 2., 2.],
          [3., 3., 3., 4., 5., 5., 5.],
          [6., 6., 6., 7., 8., 8., 8.],
          [6., 6., 6., 7., 8., 8., 8.],
          [6., 6., 6., 7., 8., 8., 8.]]]])
>>> # using different paddings for different sides
>>> m = nn.ReplicationPad2d((1, 1, 2, 0))
>>> m(input)
tensor([[[[0., 0., 1., 2., 2.],
          [0., 0., 1., 2., 2.],
          [0., 0., 1., 2., 2.],
          [3., 3., 4., 5., 5.],
          [6., 6., 7., 8., 8.]]]])
class torch.nn.ReplicationPad3d(padding) [source]
 
Pads the input tensor using replication of the input boundary. For N-dimensional padding, use torch.nn.functional.pad().  Parameters 
padding (int, tuple) – the size of the padding. If is int, uses the same padding in all boundaries. If a 6-tuple, uses (padding_left\text{padding\_left} , padding_right\text{padding\_right} , padding_top\text{padding\_top} , padding_bottom\text{padding\_bottom} , padding_front\text{padding\_front} , padding_back\text{padding\_back} )    Shape:

 Input: (N,C,Din,Hin,Win)(N, C, D_{in}, H_{in}, W_{in}) 
 
Output: (N,C,Dout,Hout,Wout)(N, C, D_{out}, H_{out}, W_{out})  where Dout=Din+padding_front+padding_backD_{out} = D_{in} + \text{padding\_front} + \text{padding\_back}  Hout=Hin+padding_top+padding_bottomH_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}  Wout=Win+padding_left+padding_rightW_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}      Examples: >>> m = nn.ReplicationPad3d(3)
>>> input = torch.randn(16, 3, 8, 320, 480)
>>> output = m(input)
>>> # using different paddings for different sides
>>> m = nn.ReplicationPad3d((3, 3, 6, 6, 1, 1))
>>> output = m(input)
class torch.nn.RNNBase(mode, input_size, hidden_size, num_layers=1, bias=True, batch_first=False, dropout=0.0, bidirectional=False, proj_size=0) [source]
 
 
flatten_parameters() [source]
 
Resets parameter data pointer so that they can use faster code paths. Right now, this works only if the module is on the GPU and cuDNN is enabled. Otherwise, it’s a no-op.
flatten_parameters() [source]
 
Resets parameter data pointer so that they can use faster code paths. Right now, this works only if the module is on the GPU and cuDNN is enabled. Otherwise, it’s a no-op.
class torch.nn.RNNCell(input_size, hidden_size, bias=True, nonlinearity='tanh') [source]
 
An Elman RNN cell with tanh or ReLU non-linearity.  h′=tanh⁡(Wihx+bih+Whhh+bhh)h' = \tanh(W_{ih} x + b_{ih} + W_{hh} h + b_{hh}) 
If nonlinearity is ‘relu’, then ReLU is used in place of tanh.  Parameters 
 
input_size – The number of expected features in the input x
 
hidden_size – The number of features in the hidden state h
 
bias – If False, then the layer does not use bias weights b_ih and b_hh. Default: True
 
nonlinearity – The non-linearity to use. Can be either 'tanh' or 'relu'. Default: 'tanh'
     Inputs: input, hidden

 
input of shape (batch, input_size): tensor containing input features 
hidden of shape (batch, hidden_size): tensor containing the initial hidden state for each element in the batch. Defaults to zero if not provided.   Outputs: h’

 
h’ of shape (batch, hidden_size): tensor containing the next hidden state for each element in the batch   Shape:

 Input1: (N,Hin)(N, H_{in})  tensor containing input features where HinH_{in}  = input_size
 Input2: (N,Hout)(N, H_{out})  tensor containing the initial hidden state for each element in the batch where HoutH_{out}  = hidden_size Defaults to zero if not provided. Output: (N,Hout)(N, H_{out})  tensor containing the next hidden state for each element in the batch     Variables 
 
~RNNCell.weight_ih – the learnable input-hidden weights, of shape (hidden_size, input_size)
 
~RNNCell.weight_hh – the learnable hidden-hidden weights, of shape (hidden_size, hidden_size)
 
~RNNCell.bias_ih – the learnable input-hidden bias, of shape (hidden_size)
 
~RNNCell.bias_hh – the learnable hidden-hidden bias, of shape (hidden_size)
     Note All the weights and biases are initialized from U(−k,k)\mathcal{U}(-\sqrt{k}, \sqrt{k})  where k=1hidden_sizek = \frac{1}{\text{hidden\_size}}   Examples: >>> rnn = nn.RNNCell(10, 20)
>>> input = torch.randn(6, 3, 10)
>>> hx = torch.randn(3, 20)
>>> output = []
>>> for i in range(6):
        hx = rnn(input[i], hx)
        output.append(hx)
class torch.nn.RReLU(lower=0.125, upper=0.3333333333333333, inplace=False) [source]
 
Applies the randomized leaky rectified liner unit function, element-wise, as described in the paper: Empirical Evaluation of Rectified Activations in Convolutional Network. The function is defined as:  RReLU(x)={xif x≥0ax otherwise \text{RReLU}(x) = \begin{cases} x & \text{if } x \geq 0 \\ ax & \text{ otherwise } \end{cases}  
where aa  is randomly sampled from uniform distribution U(lower,upper)\mathcal{U}(\text{lower}, \text{upper}) . See: https://arxiv.org/pdf/1505.00853.pdf  Parameters 
 
lower – lower bound of the uniform distribution. Default: 18\frac{1}{8} 
 
upper – upper bound of the uniform distribution. Default: 13\frac{1}{3} 
 
inplace – can optionally do the operation in-place. Default: False
     Shape:

 Input: (N,∗)(N, *)  where * means, any number of additional dimensions Output: (N,∗)(N, *) , same shape as the input    Examples: >>> m = nn.RReLU(0.1, 0.3)
>>> input = torch.randn(2)
>>> output = m(input)
class torch.nn.SELU(inplace=False) [source]
 
Applied element-wise, as:  SELU(x)=scale∗(max⁡(0,x)+min⁡(0,α∗(exp⁡(x)−1)))\text{SELU}(x) = \text{scale} * (\max(0,x) + \min(0, \alpha * (\exp(x) - 1)))  
with α=1.6732632423543772848170429916717\alpha = 1.6732632423543772848170429916717  and scale=1.0507009873554804934193349852946\text{scale} = 1.0507009873554804934193349852946 . More details can be found in the paper Self-Normalizing Neural Networks .  Parameters 
inplace (bool, optional) – can optionally do the operation in-place. Default: False    Shape:

 Input: (N,∗)(N, *)  where * means, any number of additional dimensions Output: (N,∗)(N, *) , same shape as the input     Examples: >>> m = nn.SELU()
>>> input = torch.randn(2)
>>> output = m(input)
class torch.nn.Sequential(*args) [source]
 
A sequential container. Modules will be added to it in the order they are passed in the constructor. Alternatively, an ordered dict of modules can also be passed in. To make it easier to understand, here is a small example: # Example of using Sequential
model = nn.Sequential(
          nn.Conv2d(1,20,5),
          nn.ReLU(),
          nn.Conv2d(20,64,5),
          nn.ReLU()
        )

# Example of using Sequential with OrderedDict
model = nn.Sequential(OrderedDict([
          ('conv1', nn.Conv2d(1,20,5)),
          ('relu1', nn.ReLU()),
          ('conv2', nn.Conv2d(20,64,5)),
          ('relu2', nn.ReLU())
        ]))
class torch.nn.Sigmoid [source]
 
Applies the element-wise function:  Sigmoid(x)=σ(x)=11+exp⁡(−x)\text{Sigmoid}(x) = \sigma(x) = \frac{1}{1 + \exp(-x)}  
 Shape:

 Input: (N,∗)(N, *)  where * means, any number of additional dimensions Output: (N,∗)(N, *) , same shape as the input     Examples: >>> m = nn.Sigmoid()
>>> input = torch.randn(2)
>>> output = m(input)
class torch.nn.SiLU(inplace=False) [source]
 
Applies the silu function, element-wise.  silu(x)=x∗σ(x),where σ(x) is the logistic sigmoid.\text{silu}(x) = x * \sigma(x), \text{where } \sigma(x) \text{ is the logistic sigmoid.}  
 Note See Gaussian Error Linear Units (GELUs) where the SiLU (Sigmoid Linear Unit) was originally coined, and see Sigmoid-Weighted Linear Units for Neural Network Function Approximation in Reinforcement Learning and Swish: a Self-Gated Activation Function where the SiLU was experimented with later.   Shape:

 Input: (N,∗)(N, *)  where * means, any number of additional dimensions Output: (N,∗)(N, *) , same shape as the input    Examples: >>> m = nn.SiLU()
>>> input = torch.randn(2)
>>> output = m(input)
class torch.nn.SmoothL1Loss(size_average=None, reduce=None, reduction='mean', beta=1.0) [source]
 
Creates a criterion that uses a squared term if the absolute element-wise error falls below beta and an L1 term otherwise. It is less sensitive to outliers than the torch.nn.MSELoss and in some cases prevents exploding gradients (e.g. see Fast R-CNN paper by Ross Girshick). Omitting a scaling factor of beta, this loss is also known as the Huber loss:  loss(x,y)=1n∑izi\text{loss}(x, y) = \frac{1}{n} \sum_{i} z_{i}  
where ziz_{i}  is given by:  zi={0.5(xi−yi)2/beta,if ∣xi−yi∣<beta∣xi−yi∣−0.5∗beta,otherwise z_{i} = \begin{cases} 0.5 (x_i - y_i)^2 / beta, & \text{if } |x_i - y_i| < beta \\ |x_i - y_i| - 0.5 * beta, & \text{otherwise } \end{cases}  
xx  and yy  arbitrary shapes with a total of nn  elements each the sum operation still operates over all the elements, and divides by nn . beta is an optional parameter that defaults to 1. Note: When beta is set to 0, this is equivalent to L1Loss. Passing a negative value in for beta will result in an exception. The division by nn  can be avoided if sets reduction = 'sum'.  Parameters 
 
size_average (bool, optional) – Deprecated (see reduction). By default, the losses are averaged over each loss element in the batch. Note that for some losses, there are multiple elements per sample. If the field size_average is set to False, the losses are instead summed for each minibatch. Ignored when reduce is False. Default: True
 
reduce (bool, optional) – Deprecated (see reduction). By default, the losses are averaged or summed over observations for each minibatch depending on size_average. When reduce is False, returns a loss per batch element instead and ignores size_average. Default: True
 
reduction (string, optional) – Specifies the reduction to apply to the output: 'none' | 'mean' | 'sum'. 'none': no reduction will be applied, 'mean': the sum of the output will be divided by the number of elements in the output, 'sum': the output will be summed. Note: size_average and reduce are in the process of being deprecated, and in the meantime, specifying either of those two args will override reduction. Default: 'mean'
 
beta (float, optional) – Specifies the threshold at which to change between L1 and L2 loss. This value defaults to 1.0.     Shape:

 Input: (N,∗)(N, *)  where ∗*  means, any number of additional dimensions Target: (N,∗)(N, *) , same shape as the input Output: scalar. If reduction is 'none', then (N,∗)(N, *) , same shape as the input
class torch.nn.SoftMarginLoss(size_average=None, reduce=None, reduction='mean') [source]
 
Creates a criterion that optimizes a two-class classification logistic loss between input tensor xx  and target tensor yy  (containing 1 or -1).  loss(x,y)=∑ilog⁡(1+exp⁡(−y[i]∗x[i]))x.nelement()\text{loss}(x, y) = \sum_i \frac{\log(1 + \exp(-y[i]*x[i]))}{\text{x.nelement}()}  
 Parameters 
 
size_average (bool, optional) – Deprecated (see reduction). By default, the losses are averaged over each loss element in the batch. Note that for some losses, there are multiple elements per sample. If the field size_average is set to False, the losses are instead summed for each minibatch. Ignored when reduce is False. Default: True
 
reduce (bool, optional) – Deprecated (see reduction). By default, the losses are averaged or summed over observations for each minibatch depending on size_average. When reduce is False, returns a loss per batch element instead and ignores size_average. Default: True
 
reduction (string, optional) – Specifies the reduction to apply to the output: 'none' | 'mean' | 'sum'. 'none': no reduction will be applied, 'mean': the sum of the output will be divided by the number of elements in the output, 'sum': the output will be summed. Note: size_average and reduce are in the process of being deprecated, and in the meantime, specifying either of those two args will override reduction. Default: 'mean'
     Shape:

 Input: (∗)(*)  where ∗*  means, any number of additional dimensions Target: (∗)(*) , same shape as the input Output: scalar. If reduction is 'none', then same shape as the input
class torch.nn.Softmax(dim=None) [source]
 
Applies the Softmax function to an n-dimensional input Tensor rescaling them so that the elements of the n-dimensional output Tensor lie in the range [0,1] and sum to 1. Softmax is defined as:  Softmax(xi)=exp⁡(xi)∑jexp⁡(xj)\text{Softmax}(x_{i}) = \frac{\exp(x_i)}{\sum_j \exp(x_j)}  
When the input Tensor is a sparse tensor then the unspecifed values are treated as -inf.  Shape:

 Input: (∗)(*)  where * means, any number of additional dimensions Output: (∗)(*) , same shape as the input     Returns 
a Tensor of the same dimension and shape as the input with values in the range [0, 1]  Parameters 
dim (int) – A dimension along which Softmax will be computed (so every slice along dim will sum to 1).    Note This module doesn’t work directly with NLLLoss, which expects the Log to be computed between the Softmax and itself. Use LogSoftmax instead (it’s faster and has better numerical properties).  Examples: >>> m = nn.Softmax(dim=1)
>>> input = torch.randn(2, 3)
>>> output = m(input)
class torch.nn.Softmax2d [source]
 
Applies SoftMax over features to each spatial location. When given an image of Channels x Height x Width, it will apply Softmax to each location (Channels,hi,wj)(Channels, h_i, w_j)   Shape:

 Input: (N,C,H,W)(N, C, H, W) 
 Output: (N,C,H,W)(N, C, H, W)  (same shape as input)     Returns 
a Tensor of the same dimension and shape as the input with values in the range [0, 1]   Examples: >>> m = nn.Softmax2d()
>>> # you softmax over the 2nd dimension
>>> input = torch.randn(2, 3, 12, 13)
>>> output = m(input)
class torch.nn.Softmin(dim=None) [source]
 
Applies the Softmin function to an n-dimensional input Tensor rescaling them so that the elements of the n-dimensional output Tensor lie in the range [0, 1] and sum to 1. Softmin is defined as:  Softmin(xi)=exp⁡(−xi)∑jexp⁡(−xj)\text{Softmin}(x_{i}) = \frac{\exp(-x_i)}{\sum_j \exp(-x_j)}  
 Shape:

 Input: (∗)(*)  where * means, any number of additional dimensions Output: (∗)(*) , same shape as the input     Parameters 
dim (int) – A dimension along which Softmin 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 values in the range [0, 1]   Examples: >>> m = nn.Softmin()
>>> input = torch.randn(2, 3)
>>> output = m(input)