dim (int): the dimension on which to split the input. Default: -1
Shape:
- - Input: :math:`(*, N, *)` where `*` means, any number of additional
+ - Input: :math:`(\ast_1, N, \ast_2)` where `*` means, any number of additional
dimensions
- - Output: :math:`(*, N / 2, *)`
+ - Output: :math:`(\ast_1, M, \ast_2)` where :math:`M=N/2`
Examples::
\text{Softmin}(x_{i}) = \frac{\exp(-x_i)}{\sum_j \exp(-x_j)}
Shape:
- - Input: any shape
- - Output: same as input
+ - Input: :math:`(*)` where `*` means, any number of additional
+ dimensions
+ - Output: :math:`(*)`, same shape as the input
Arguments:
dim (int): A dimension along which Softmin will be computed (so every slice
\text{Softmax}(x_{i}) = \frac{\exp(x_i)}{\sum_j \exp(x_j)}
Shape:
- - Input: any shape
- - Output: same as input
+ - Input: :math:`(*)` where `*` means, any number of additional
+ dimensions
+ - Output: :math:`(*)`, same shape as the input
Returns:
a Tensor of the same dimension and shape as the input with
\text{LogSoftmax}(x_{i}) = \log\left(\frac{\exp(x_i) }{ \sum_j \exp(x_j)} \right)
Shape:
- - Input: any shape
- - Output: same as input
+ - Input: :math:`(*)` where `*` means, any number of additional
+ dimensions
+ - Output: :math:`(*)`, same shape as the input
Arguments:
dim (int): A dimension along which Softmax will be computed (so every slice
Shape:
- input: :math:`(N, in\_features)`
- target: :math:`(N)` where each value satisfies :math:`0 <= target[i] <= n\_classes`
- - output: :math:`(N)`
- - loss: ``Scalar``
+ - output1: :math:`(N)`
+ - output2: ``Scalar``
.. _Efficient softmax approximation for GPUs:
('conv2', nn.Conv2d(20,64,5)),
('relu2', nn.ReLU())
]))
+
+ Shape:
+ - Input: :math:`(*)` where `*` means, any number of additional
+ dimensions
+ - Output: :math:`(*)`, same shape as the input
"""
def __init__(self, *args):
inplace: If set to ``True``, will do this operation in-place. Default: ``False``
Shape:
- - Input: `Any`. Input can be of any shape
- - Output: `Same`. Output is of the same shape as input
+ - Input: :math:`(*)`. Input can be of any shape
+ - Output: :math:`(*)`. Output is of the same shape as input
Examples::
in-place
Shape:
- - Input: `Any`. Input can be of any shape
- - Output: `Same`. Output is of the same shape as input
+ - Input: :math:`(*)`. Input can be of any shape
+ - Output: :math:`(*)`. Output is of the same shape as input
Examples::
Default: ``True``
Shape:
- - Input: :math:`(N, *, \text{in\_features})` where :math:`*` means any number of
- additional dimensions
- - Output: :math:`(N, *, \text{out\_features})` where all but the last dimension
- are the same shape as the input.
+ - Input: :math:`(N, *, H_{in})` where :math:`*` means any number of
+ additional dimensions and :math:`H_{in} = \text{in\_features}`
+ - Output: :math:`(N, *, H_{out})` where all but the last dimension
+ are the same shape as the input and :math:`H_{out} = \text{out\_features}`.
Attributes:
weight: the learnable weights of the module of shape
Default: ``True``
Shape:
- - Input: :math:`(N, *, \text{in1\_features})`, :math:`(N, *, \text{in2\_features})`
- where :math:`*` means any number of additional dimensions. All but the last
- dimension of the inputs should be the same.
- - Output: :math:`(N, *, \text{out\_features})` where all but the last dimension
- are the same shape as the input.
+ - Input1: :math:`(N, *, H_{in1})` where :math:`H_{in1}=\text{in1\_features}` and
+ :math:`*` means any number of additional dimensions. All but the last dimension
+ of the inputs should be the same.
+ - Input2: :math:`(N, *, H_{in2})` where :math:`H_{in2}=\text{in2\_features}`.
+ - Output: :math:`(N, *, H_{out})` where :math:`H_{out}=\text{out\_features}`
+ and all but the last dimension are the same shape as the input.
Attributes:
weight: the learnable weights of the module of shape
>>> target = torch.randn(5, 2)
>>> output = loss(log_input, target)
>>> output.backward()
+
+ Shape:
+ - Input: :math:`(N, *)` where `*` means, any number of additional
+ dimensions
+ - Target: :math:`(N, *)`, same shape as the input
+ - Output: scalar by default. If `reduce` is ``False``, then :math:`(N, *)`,
+ the same shape as the input
"""
__constants__ = ['log_input', 'full', 'eps', 'reduction']
Shape:
- - input: :math:`(N, *)` where `*` means, any number of additional
+ - Input: :math:`(N, *)` where `*` means, any number of additional
dimensions
- - target: :math:`(N, *)`, same shape as the input
- - output: scalar by default. If `reduce` is ``False``, then :math:`(N, *)`,
+ - Target: :math:`(N, *)`, same shape as the input
+ - Output: scalar by default. If `reduce` is ``False``, then :math:`(N, *)`,
the same shape as the input
"""
- Input: :math:`(N, *)` where `*` means, any number of additional
dimensions
- Target: :math:`(N, *)`, same shape as the input
+ - Output: scalar. If `reduce` is False, then :math:`(N, *)`, same
+ shape as input.
Examples::
specifying either of those two args will override :attr:`reduction`. Default: 'mean'
Shape:
- - Input: Tensor of arbitrary shape. The sum operation operates over all the elements.
- - Target: Same shape as input.
+ - Input: :math:`(*)` where `*` means, any number of dimensions. The sum operation
+ operates over all the elements.
+ - Target: :math:`(*)`, same shape as the input
- Output: scalar. If reduce is ``False``, then same shape as the input
"""
__constants__ = ['margin', 'reduction']
specifying either of those two args will override :attr:`reduction`. Default: 'mean'
Shape:
- - Input: Tensor of arbitrary shape.
- - Target: Same shape as input.
+ - Input: :math:`(*)` where `*` means, any number of additional
+ dimensions
+ - Target: :math:`(*)`, same shape as the input
- Output: scalar. If reduce is ``False``, then same shape as the input
"""
k: additive factor. Default: 1
Shape:
- - Input: :math:`(N, C, ...)`
- - Output: :math:`(N, C, ...)` (same shape as input)
+ - Input: :math:`(N, C, *)`
+ - Output: :math:`(N, C, *)` (same shape as input)
Examples::
and zeros (for biases). Default: ``True``.
Shape:
- - Input: :math:`(N, num\_channels, *)`
- - Output: :math:`(N, num\_channels, *)` (same shape as input)
+ - Input: :math:`(N, C, *)` where :math:`C=\text{num\_channels}`
+ - Output: :math:`(N, C, *)` (same shape as input)
Examples::
upscale_factor (int): factor to increase spatial resolution by
Shape:
- - Input: :math:`(N, C \times \text{upscale_factor}^2, H, W)`
- - Output: :math:`(N, C, H \times \text{upscale_factor}, W \times \text{upscale_factor})`
+ - Input: :math:`(N, L, H_{in}, W_{in})` where :math:`L=C \times \text{upscale\_factor}^2`
+ - Output: :math:`(N, C, H_{out}, W_{out})` where :math:`H \times \text{upscale\_factor}`
+ and :math:`W \times \text{upscale\_factor}`
Examples::
Like *output*, the layers can be separated using
``h_n.view(num_layers, num_directions, batch, hidden_size)``.
+ Shape:
+ - Input1: :math:`(L, N, H_{in})` tensor containing input features where
+ :math:`H_{in}=\text{input\_size}` and `L` represents a sequence length.
+ - Input2: :math:`(S, N, H_{out})` tensor
+ containing the initial hidden state for each element in the batch.
+ :math:`H_{out}=\text{hidden\_size}`
+ Defaults to zero if not provided. where :math:`S=\text{num\_layers} * \text{num\_directions}`
+ If the RNN is bidirectional, num_directions should be 2, else it should be 1.
+ - Output1: :math:`(L, N, H_{all})` where :math:`H_all=\text{num\_directions} * \text{hidden\_size}`
+ - Output2: :math:`(S, N, H_{out})` tensor containing the next hidden state
+ for each element in the batch
+
Attributes:
weight_ih_l[k]: the learnable input-hidden weights of the k-th layer,
of shape `(hidden_size * input_size)` for `k = 0`. Otherwise, the shape is
Like *output*, the layers can be separated using
``h_n.view(num_layers, num_directions, batch, hidden_size)``.
+ Shape:
+ - Input1: :math:`(L, N, H_{in})` tensor containing input features where
+ :math:`H_{in}=\text{input\_size}` and `L` represents a sequence length.
+ - Input2: :math:`(S, N, H_{out})` tensor
+ containing the initial hidden state for each element in the batch.
+ :math:`H_{out}=\text{hidden\_size}`
+ Defaults to zero if not provided. where :math:`S=\text{num\_layers} * \text{num\_directions}`
+ If the RNN is bidirectional, num_directions should be 2, else it should be 1.
+ - Output1: :math:`(L, N, H_{all})` where :math:`H_all=\text{num\_directions} * \text{hidden\_size}`
+ - Output2: :math:`(S, N, H_{out})` tensor containing the next hidden state
+ for each element in the batch
+
Attributes:
weight_ih_l[k] : the learnable input-hidden weights of the :math:`\text{k}^{th}` layer
(W_ir|W_iz|W_in), of shape `(3*hidden_size x input_size)`
- **h'** of shape `(batch, hidden_size)`: tensor containing the next hidden state
for each element in the batch
+ Shape:
+ - Input1: :math:`(N, H_{in})` tensor containing input features where
+ :math:`H_{in}` = `input_size`
+ - Input2: :math:`(N, H_{out})` tensor containing the initial hidden
+ state for each element in the batch where :math:`H_{out}` = `hidden_size`
+ Defaults to zero if not provided.
+ - Output: :math:`(N, H_{out})` tensor containing the next hidden state
+ for each element in the batch
+
Attributes:
weight_ih: the learnable input-hidden weights, of shape
`(hidden_size x input_size)`
- **h'** of shape `(batch, hidden_size)`: tensor containing the next hidden state
for each element in the batch
+ Shape:
+ - Input1: :math:`(N, H_{in})` tensor containing input features where
+ :math:`H_{in}` = `input_size`
+ - Input2: :math:`(N, H_{out})` tensor containing the initial hidden
+ state for each element in the batch where :math:`H_{out}` = `hidden_size`
+ Defaults to zero if not provided.
+ - Output: :math:`(N, H_{out})` tensor containing the next hidden state
+ for each element in the batch
+
Attributes:
weight_ih: the learnable input-hidden weights, of shape
`(3*hidden_size x input_size)`
initialized from :math:`\mathcal{N}(0, 1)`
Shape:
-
- - Input: LongTensor of arbitrary shape containing the indices to extract
- - Output: `(*, embedding_dim)`, where `*` is the input shape
+ - Input: :math:`(*)`, LongTensor of arbitrary shape containing the indices to extract
+ - Output: :math:`(*, H)`, where `*` is the input shape and :math:`H=\text{embedding\_dim}`
.. note::
Keep in mind that only a limited number of optimizers support