chunk_id large_stringlengths 36 36 | doc_type large_stringclasses 2
values | category large_stringclasses 17
values | document large_stringclasses 50
values | version_raw large_stringclasses 590
values | chunk_index int64 0 262 | text large_stringlengths 11 5.69k | file_path large_stringclasses 882
values |
|---|---|---|---|---|---|---|---|
c1baa957-04d5-594e-a982-5da78924c219 | docs | pytorch | pytorch_lstm | 26 | 5 | * **h\_0**: tensor of shape (D∗num\_layers,Hout)(D \* \text{num\\_layers}, H\_{out})(D∗num\_layers,Hout) for unbatched input or
(D∗num\_layers,N,Hout)(D \* \text{num\\_layers}, N, H\_{out})(D∗num\_layers,N,Hout) containing the
initial hidden state for each element in the input sequence.
... | large_dataset/raw/docs/pytorch/lstm/lstm_26.md |
2051ca4c-1412-5aa4-85c1-9c7b6bc991b3 | docs | pytorch | pytorch_lstm | 26 | 6 | L ={} & \text{sequence length} \\
D ={} & 2 \text{ if bidirectional=True otherwise } 1 \\
H\_{in} ={} & \text{input\\_size} \\
H\_{cell} ={} & \text{hidden\\_size} \\
H\_{out} ={} & \text{proj\\_size if } \text{proj\\_size}>0 \text{ otherwise hidden\\_size} \\
\end{aligne... | large_dataset/raw/docs/pytorch/lstm/lstm_26.md |
7d0facde-9868-501f-9c41-2b067848a51a | docs | pytorch | pytorch_lstm | 26 | 7 | [`torch.nn.utils.rnn.PackedSequence`](torch.nn.utils.rnn.PackedSequence.html#torch.nn.utils.rnn.PackedSequence "torch.nn.utils.rnn.PackedSequence") has been given as the input, the output
will also be a packed sequence. When `bidirectional=True`, output will contain
a concatenation of the ... | large_dataset/raw/docs/pytorch/lstm/lstm_26.md |
8530fecc-4be9-562d-b967-f608a4d5485b | docs | pytorch | pytorch_lstm | 26 | 8 | (D∗num\_layers,N,Hcell)(D \* \text{num\\_layers}, N, H\_{cell})(D∗num\_layers,N,Hcell) containing the
final cell state for each element in the sequence. When `bidirectional=True`,
c\_n will contain a concatenation of the final forward and reverse cell states, respectively.
Variables
... | large_dataset/raw/docs/pytorch/lstm/lstm_26.md |
794316f5-35f5-5ec4-bb61-acdc2762933b | docs | pytorch | pytorch_lstm | 26 | 9 | * **bias\_ih\_l[k]** – the learnable input-hidden bias of the kth\text{k}^{th}kth layer
(b\_ii|b\_if|b\_ig|b\_io), of shape (4\*hidden\_size)
* **bias\_hh\_l[k]** – the learnable hidden-hidden bias of the kth\text{k}^{th}kth layer
(b\_hi|b\_hf|b\_hg|b\_ho), of shape (4\*hidden\_size)... | large_dataset/raw/docs/pytorch/lstm/lstm_26.md |
43f6ceaa-b1f3-5a2a-84af-1110d8ecfee5 | docs | pytorch | pytorch_lstm | 26 | 10 | * **bias\_hh\_l[k]\_reverse** – Analogous to bias\_hh\_l[k] for the reverse direction.
Only present when `bidirectional=True`.
* **weight\_hr\_l[k]\_reverse** – Analogous to weight\_hr\_l[k] for the reverse direction.
Only present when `bidirectional=True` and `proj_size > 0` was spe... | large_dataset/raw/docs/pytorch/lstm/lstm_26.md |
dac8895f-5e60-5474-998d-68fecce545cb | docs | pytorch | pytorch_lstm | 26 | 11 | `batch_first` argument is ignored for unbatched inputs.
Note
`proj_size` should be smaller than `hidden_size`.
Warning
There are known non-determinism issues for RNN functions on some versions of cuDNN and CUDA.
You can enforce deterministic behavior by setting the following environment vari... | large_dataset/raw/docs/pytorch/lstm/lstm_26.md |
24659dc8-e9d4-5b49-9d06-d80657f1c2db | docs | pytorch | pytorch_lstm | 26 | 12 | persistent algorithm can be selected to improve performance.
Examples:
```None
>>> rnn = nn.LSTM(10, 20, 2)
>>> input = torch.randn(5, 3, 10)
>>> h0 = torch.randn(2, 3, 20)
>>> c0 = torch.randn(2, 3, 20)
>>> output, (hn, cn) = rnn(input, (h0, c0))
```
[Next [[source]](../_modules/torch/nn/modules/rnn.html#RNN)[¶](#torch.nn.RNN "Permalink to this definition")
: Applies a multi-layer Elman RNN with tanh\tanhtanh or ReLU\text{ReLU}ReLU no... | large_dataset/raw/docs/pytorch/rnn/rnn_20.md |
067d07d1-4d69-545c-82a7-2c445fa0df17 | docs | pytorch | pytorch_rnn | 20 | 1 | * **hidden\_size** – The number of features in the hidden state h
* **num\_layers** – Number of recurrent layers. E.g., setting `num_layers=2`
would mean stacking two RNNs together to form a stacked RNN,
with the second RNN taking in outputs of the first RNN and
computing t... | large_dataset/raw/docs/pytorch/rnn/rnn_20.md |
68f2b88a-b7bc-555c-a08e-69ec9c449078 | docs | pytorch | pytorch_rnn | 20 | 2 | RNN layer except the last layer, with dropout probability equal to
`dropout`. Default: 0
* **bidirectional** – If `True`, becomes a bidirectional RNN. Default: `False`
Inputs: input, h\_0
: * **input**: tensor of shape (L,Hin)(L, H\_{in})(L,Hin) for unbatched input,
(L,... | large_dataset/raw/docs/pytorch/rnn/rnn_20.md |
6c8a45f1-b621-52bc-8bc2-da3149e962d9 | docs | pytorch | pytorch_rnn | 20 | 3 | * **h\_0**: tensor of shape (D∗num\_layers,Hout)(D \* \text{num\\_layers}, H\_{out})(D∗num\_layers,Hout) for unbatched input or
(D∗num\_layers,N,Hout)(D \* \text{num\\_layers}, N, H\_{out})(D∗num\_layers,N,Hout) containing the initial hidden
state for the input sequence batch. Defaults to ... | large_dataset/raw/docs/pytorch/rnn/rnn_20.md |
a4b20480-d9cc-54c7-93e1-973ed42f0eee | docs | pytorch | pytorch_rnn | 20 | 4 | (L,N,D∗Hout)(L, N, D \* H\_{out})(L,N,D∗Hout) when `batch_first=False` or
(N,L,D∗Hout)(N, L, D \* H\_{out})(N,L,D∗Hout) when `batch_first=True` containing the output features
(h\_t) from the last layer of the RNN, for each t. If a
[`torch.nn.utils.rnn.PackedSequence`](torch.nn.... | large_dataset/raw/docs/pytorch/rnn/rnn_20.md |
33ed31d6-7a15-5714-97aa-c2f19079162c | docs | pytorch | pytorch_rnn | 20 | 5 | (hidden\_size, num\_directions \* hidden\_size)
* **weight\_hh\_l[k]** – the learnable hidden-hidden weights of the k-th layer,
of shape (hidden\_size, hidden\_size)
* **bias\_ih\_l[k]** – the learnable input-hidden bias of the k-th layer,
of shape (hidden\_size)
* ... | large_dataset/raw/docs/pytorch/rnn/rnn_20.md |
0f854359-a7ce-56b0-b2ae-76127784f8f3 | docs | pytorch | pytorch_rnn | 20 | 6 | There are known non-determinism issues for RNN functions on some versions of cuDNN and CUDA.
You can enforce deterministic behavior by setting the following environment variables:
On CUDA 10.1, set environment variable `CUDA_LAUNCH_BLOCKING=1`.
This may affect performance.
On CUDA 10.2 or later, s... | large_dataset/raw/docs/pytorch/rnn/rnn_20.md |
d45afe56-f890-5724-8f50-dac165a4d044 | docs | pytorch | pytorch_rnn | 20 | 7 | >>> h0 = torch.randn(2, 3, 20)
>>> output, hn = rnn(input, h0)
```
[Next ](torch.nn.LSTM.html "LSTM")
[ Previous](torch.nn.RNNBase.html "RNNBase")
---
© Copyright 2023, PyTorch Contributors.
Built with [Sphinx]... | large_dataset/raw/docs/pytorch/rnn/rnn_20.md |
3b5b1a7d-9631-5ad0-ae5f-db9f019494d5 | docs | pytorch | pytorch_rnn | 21 | 0 | # RNN¶
Source: https://docs.pytorch.org/docs/2.1/generated/torch.nn.RNN.html
Version: 2.1
*class* torch.nn.RNN(*self*, *input\_size*, *hidden\_size*, *num\_layers=1*, *nonlinearity='tanh'*, *bias=True*, *batch\_first=False*, *dropout=0.0*, *bidirectional=False*, *device=None*, *dtype=None*)[[source]](../_modules/torc... | large_dataset/raw/docs/pytorch/rnn/rnn_21.md |
824b1a7b-a26a-54e4-b7e7-e1f54ce042a3 | docs | pytorch | pytorch_rnn | 21 | 1 | If `nonlinearity` is `'relu'`, then ReLU\text{ReLU}ReLU is used instead of tanh\tanhtanh.
Parameters
: * **input\_size** – The number of expected features in the input x
* **hidden\_size** – The number of features in the hidden state h
* **num\_layers** – Number of recurrent layers. E.g.... | large_dataset/raw/docs/pytorch/rnn/rnn_21.md |
7389bdc6-5878-5406-84bb-d725c98a38c4 | docs | pytorch | pytorch_rnn | 21 | 2 | Inputs/Outputs sections below for details. Default: `False`
* **dropout** – If non-zero, introduces a Dropout layer on the outputs of each
RNN layer except the last layer, with dropout probability equal to
`dropout`. Default: 0
* **bidirectional** – If `True`, becomes a bid... | large_dataset/raw/docs/pytorch/rnn/rnn_21.md |
954f3794-1b63-505a-bb2d-0545132ec473 | docs | pytorch | pytorch_rnn | 21 | 3 | [`torch.nn.utils.rnn.pack_sequence()`](torch.nn.utils.rnn.pack_sequence.html#torch.nn.utils.rnn.pack_sequence "torch.nn.utils.rnn.pack_sequence") for details.
* **h\_0**: tensor of shape (D∗num\_layers,Hout)(D \* \text{num\\_layers}, H\_{out})(D∗num\_layers,Hout) for unbatched input or
(D∗n... | large_dataset/raw/docs/pytorch/rnn/rnn_21.md |
0e9dbd4b-de04-541f-ac3e-4e37e08ca995 | docs | pytorch | pytorch_rnn | 21 | 4 | Outputs: output, h\_n
: * **output**: tensor of shape (L,D∗Hout)(L, D \* H\_{out})(L,D∗Hout) for unbatched input,
(L,N,D∗Hout)(L, N, D \* H\_{out})(L,N,D∗Hout) when `batch_first=False` or
(N,L,D∗Hout)(N, L, D \* H\_{out})(N,L,D∗Hout) when `batch_first=True` containing the output feature... | large_dataset/raw/docs/pytorch/rnn/rnn_21.md |
ea71229a-621a-594c-beb4-2486a2bde252 | docs | pytorch | pytorch_rnn | 21 | 5 | : * **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
(hidden\_size, num\_directions \* hidden\_size)
* **weight\_hh\_l[k]** – the learnable hidden-hidden weights of the k-th layer,
... | large_dataset/raw/docs/pytorch/rnn/rnn_21.md |
defd7963-fc69-5ba8-84b7-b674853603bc | docs | pytorch | pytorch_rnn | 21 | 6 | `batch_first` argument is ignored for unbatched inputs.
Warning
There are known non-determinism issues for RNN functions on some versions of cuDNN and CUDA.
You can enforce deterministic behavior by setting the following environment variables:
On CUDA 10.1, set environment variable `CUDA_LAUNCH_B... | large_dataset/raw/docs/pytorch/rnn/rnn_21.md |
4b3afb1d-bebd-5b77-9428-87f4df60af69 | docs | pytorch | pytorch_rnn | 21 | 7 | >>> rnn = nn.RNN(10, 20, 2)
>>> input = torch.randn(5, 3, 10)
>>> h0 = torch.randn(2, 3, 20)
>>> output, hn = rnn(input, h0)
```
[Next ](torch.nn.LSTM.html "LSTM")
[ Previous](torch.nn.RNNBase.html "RNNBas... | large_dataset/raw/docs/pytorch/rnn/rnn_21.md |
551c9afe-e317-5dc5-8dc9-b4120ae9fa4d | docs | pytorch | pytorch_rnn | 22 | 0 | # RNN¶
Source: https://docs.pytorch.org/docs/2.2/generated/torch.nn.RNN.html
Version: 2.2
*class* torch.nn.RNN(*self*, *input\_size*, *hidden\_size*, *num\_layers=1*, *nonlinearity='tanh'*, *bias=True*, *batch\_first=False*, *dropout=0.0*, *bidirectional=False*, *device=None*, *dtype=None*)[[source]](../_modules/torc... | large_dataset/raw/docs/pytorch/rnn/rnn_22.md |
daef2878-62f1-5b66-8c6b-fa9d755fa831 | docs | pytorch | pytorch_rnn | 22 | 1 | If `nonlinearity` is `'relu'`, then ReLU\text{ReLU}ReLU is used instead of tanh\tanhtanh.
Parameters
: * **input\_size** – The number of expected features in the input x
* **hidden\_size** – The number of features in the hidden state h
* **num\_layers** – Number of recurrent layers. E.g.... | large_dataset/raw/docs/pytorch/rnn/rnn_22.md |
7c8a2fb7-898f-53bf-bdf9-aa2010630b21 | docs | pytorch | pytorch_rnn | 22 | 2 | Inputs/Outputs sections below for details. Default: `False`
* **dropout** – If non-zero, introduces a Dropout layer on the outputs of each
RNN layer except the last layer, with dropout probability equal to
`dropout`. Default: 0
* **bidirectional** – If `True`, becomes a bid... | large_dataset/raw/docs/pytorch/rnn/rnn_22.md |
75fbf5ba-4c57-53a3-9573-651980902b06 | docs | pytorch | pytorch_rnn | 22 | 3 | [`torch.nn.utils.rnn.pack_sequence()`](torch.nn.utils.rnn.pack_sequence.html#torch.nn.utils.rnn.pack_sequence "torch.nn.utils.rnn.pack_sequence") for details.
* **h\_0**: tensor of shape (D∗num\_layers,Hout)(D \* \text{num\\_layers}, H\_{out})(D∗num\_layers,Hout) for unbatched input or
(D∗n... | large_dataset/raw/docs/pytorch/rnn/rnn_22.md |
c5e09dca-0a60-54c0-a7e1-774c04ab9776 | docs | pytorch | pytorch_rnn | 22 | 4 | Outputs: output, h\_n
: * **output**: tensor of shape (L,D∗Hout)(L, D \* H\_{out})(L,D∗Hout) for unbatched input,
(L,N,D∗Hout)(L, N, D \* H\_{out})(L,N,D∗Hout) when `batch_first=False` or
(N,L,D∗Hout)(N, L, D \* H\_{out})(N,L,D∗Hout) when `batch_first=True` containing the output feature... | large_dataset/raw/docs/pytorch/rnn/rnn_22.md |
15d6698c-2c9a-55cf-ab68-e6142d735090 | docs | pytorch | pytorch_rnn | 22 | 5 | : * **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
(hidden\_size, num\_directions \* hidden\_size)
* **weight\_hh\_l[k]** – the learnable hidden-hidden weights of the k-th layer,
... | large_dataset/raw/docs/pytorch/rnn/rnn_22.md |
8aa32060-b260-5771-baf5-c9540425a56b | docs | pytorch | pytorch_rnn | 22 | 6 | `batch_first` argument is ignored for unbatched inputs.
Warning
There are known non-determinism issues for RNN functions on some versions of cuDNN and CUDA.
You can enforce deterministic behavior by setting the following environment variables:
On CUDA 10.1, set environment variable `CUDA_LAUNCH_B... | large_dataset/raw/docs/pytorch/rnn/rnn_22.md |
88c3c926-bba9-5003-bf6f-81cd16a46e28 | docs | pytorch | pytorch_rnn | 22 | 7 | >>> rnn = nn.RNN(10, 20, 2)
>>> input = torch.randn(5, 3, 10)
>>> h0 = torch.randn(2, 3, 20)
>>> output, hn = rnn(input, h0)
```
[Next ](torch.nn.LSTM.html "LSTM")
[ Previous](torch.nn.RNNBase.html "RNNBas... | large_dataset/raw/docs/pytorch/rnn/rnn_22.md |
9c66d119-9442-5472-870f-e3fecbb0e799 | docs | pytorch | pytorch_rnn | 23 | 0 | # RNN¶
Source: https://docs.pytorch.org/docs/2.3/generated/torch.nn.RNN.html
Version: 2.3
*class* torch.nn.RNN(*input\_size*, *hidden\_size*, *num\_layers=1*, *nonlinearity='tanh'*, *bias=True*, *batch\_first=False*, *dropout=0.0*, *bidirectional=False*, *device=None*, *dtype=None*)[[source]](../_modules/torch/nn/mod... | large_dataset/raw/docs/pytorch/rnn/rnn_23.md |
40a4a892-be4e-58e8-9040-141eeb6ae95a | docs | pytorch | pytorch_rnn | 23 | 1 | If `nonlinearity` is `'relu'`, then ReLU\text{ReLU}ReLU is used instead of tanh\tanhtanh.
```None
# Efficient implementation equivalent to the following with bidirectional=False
def forward(x, h_0=None):
if batch_first:
x = x.transpose(0, 1)
seq_len, batch_size, _ = x.size(... | large_dataset/raw/docs/pytorch/rnn/rnn_23.md |
e439de50-1c3b-53d9-a18d-a741c790ef2b | docs | pytorch | pytorch_rnn | 23 | 2 | : * **input\_size** – The number of expected features in the input x
* **hidden\_size** – The number of features in the hidden state h
* **num\_layers** – Number of recurrent layers. E.g., setting `num_layers=2`
would mean stacking two RNNs together to form a stacked RNN,
with ... | large_dataset/raw/docs/pytorch/rnn/rnn_23.md |
1ffbc140-bd57-5bdd-aa32-a80160a8cdd2 | docs | pytorch | pytorch_rnn | 23 | 3 | * **dropout** – If non-zero, introduces a Dropout layer on the outputs of each
RNN layer except the last layer, with dropout probability equal to
`dropout`. Default: 0
* **bidirectional** – If `True`, becomes a bidirectional RNN. Default: `False`
Inputs: input, h\_0
: * **... | large_dataset/raw/docs/pytorch/rnn/rnn_23.md |
947087b2-2623-5ee1-b179-0f603429137f | docs | pytorch | pytorch_rnn | 23 | 4 | * **h\_0**: tensor of shape (D∗num\_layers,Hout)(D \* \text{num\\_layers}, H\_{out})(D∗num\_layers,Hout) for unbatched input or
(D∗num\_layers,N,Hout)(D \* \text{num\\_layers}, N, H\_{out})(D∗num\_layers,N,Hout) containing the initial hidden
state for the input sequence batch. Defaults to ... | large_dataset/raw/docs/pytorch/rnn/rnn_23.md |
d77a696e-f690-58a5-ac78-1b4dde42671b | docs | pytorch | pytorch_rnn | 23 | 5 | (L,N,D∗Hout)(L, N, D \* H\_{out})(L,N,D∗Hout) when `batch_first=False` or
(N,L,D∗Hout)(N, L, D \* H\_{out})(N,L,D∗Hout) when `batch_first=True` containing the output features
(h\_t) from the last layer of the RNN, for each t. If a
[`torch.nn.utils.rnn.PackedSequence`](torch.nn.... | large_dataset/raw/docs/pytorch/rnn/rnn_23.md |
5ceb5a71-f2d8-5703-83a2-04e418414ea3 | docs | pytorch | pytorch_rnn | 23 | 6 | (hidden\_size, num\_directions \* hidden\_size)
* **weight\_hh\_l[k]** – the learnable hidden-hidden weights of the k-th layer,
of shape (hidden\_size, hidden\_size)
* **bias\_ih\_l[k]** – the learnable input-hidden bias of the k-th layer,
of shape (hidden\_size)
* ... | large_dataset/raw/docs/pytorch/rnn/rnn_23.md |
7425a23c-c0b2-5b27-a8e9-d9302d9d59c0 | docs | pytorch | pytorch_rnn | 23 | 7 | There are known non-determinism issues for RNN functions on some versions of cuDNN and CUDA.
You can enforce deterministic behavior by setting the following environment variables:
On CUDA 10.1, set environment variable `CUDA_LAUNCH_BLOCKING=1`.
This may affect performance.
On CUDA 10.2 or later, s... | large_dataset/raw/docs/pytorch/rnn/rnn_23.md |
e97f508d-92a6-5e7b-9153-810d7d4d6311 | docs | pytorch | pytorch_rnn | 23 | 8 | >>> h0 = torch.randn(2, 3, 20)
>>> output, hn = rnn(input, h0)
```
[Next ](torch.nn.LSTM.html "LSTM")
[ Previous](torch.nn.RNNBase.html "RNNBase")
---
© Copyright 2023, PyTorch Contributors.
Built with [Sphinx]... | large_dataset/raw/docs/pytorch/rnn/rnn_23.md |
726a9a7a-b3fd-5b64-a19d-8e56ab0dece7 | docs | pytorch | pytorch_rnn | 24 | 0 | # RNN¶
Source: https://docs.pytorch.org/docs/2.4/generated/torch.nn.RNN.html
Version: 2.4
*class* torch.nn.RNN(*input\_size*, *hidden\_size*, *num\_layers=1*, *nonlinearity='tanh'*, *bias=True*, *batch\_first=False*, *dropout=0.0*, *bidirectional=False*, *device=None*, *dtype=None*)[[source]](../_modules/torch/nn/mod... | large_dataset/raw/docs/pytorch/rnn/rnn_24.md |
dee53151-c79b-5040-8d03-99172edbda3f | docs | pytorch | pytorch_rnn | 24 | 1 | If `nonlinearity` is `'relu'`, then ReLU\text{ReLU}ReLU is used instead of tanh\tanhtanh.
```None
# Efficient implementation equivalent to the following with bidirectional=False
def forward(x, h_0=None):
if batch_first:
x = x.transpose(0, 1)
seq_len, batch_size, _ = x.size(... | large_dataset/raw/docs/pytorch/rnn/rnn_24.md |
0fad6133-b740-5ca7-98b2-43a0f79e480b | docs | pytorch | pytorch_rnn | 24 | 2 | : * **input\_size** – The number of expected features in the input x
* **hidden\_size** – The number of features in the hidden state h
* **num\_layers** – Number of recurrent layers. E.g., setting `num_layers=2`
would mean stacking two RNNs together to form a stacked RNN,
with ... | large_dataset/raw/docs/pytorch/rnn/rnn_24.md |
40592e31-d94a-5bd2-976b-a157deacde65 | docs | pytorch | pytorch_rnn | 24 | 3 | * **dropout** – If non-zero, introduces a Dropout layer on the outputs of each
RNN layer except the last layer, with dropout probability equal to
`dropout`. Default: 0
* **bidirectional** – If `True`, becomes a bidirectional RNN. Default: `False`
Inputs: input, h\_0
: * **... | large_dataset/raw/docs/pytorch/rnn/rnn_24.md |
1baa780c-4a51-5a86-9ee9-1c962559636a | docs | pytorch | pytorch_rnn | 24 | 4 | * **h\_0**: tensor of shape (D∗num\_layers,Hout)(D \* \text{num\\_layers}, H\_{out})(D∗num\_layers,Hout) for unbatched input or
(D∗num\_layers,N,Hout)(D \* \text{num\\_layers}, N, H\_{out})(D∗num\_layers,N,Hout) containing the initial hidden
state for the input sequence batch. Defaults to ... | large_dataset/raw/docs/pytorch/rnn/rnn_24.md |
b5443d65-0c41-5068-9e92-f33413f01448 | docs | pytorch | pytorch_rnn | 24 | 5 | (L,N,D∗Hout)(L, N, D \* H\_{out})(L,N,D∗Hout) when `batch_first=False` or
(N,L,D∗Hout)(N, L, D \* H\_{out})(N,L,D∗Hout) when `batch_first=True` containing the output features
(h\_t) from the last layer of the RNN, for each t. If a
[`torch.nn.utils.rnn.PackedSequence`](torch.nn.... | large_dataset/raw/docs/pytorch/rnn/rnn_24.md |
9235031c-5b27-521d-a73a-1ef0669b269f | docs | pytorch | pytorch_rnn | 24 | 6 | (hidden\_size, num\_directions \* hidden\_size)
* **weight\_hh\_l[k]** – the learnable hidden-hidden weights of the k-th layer,
of shape (hidden\_size, hidden\_size)
* **bias\_ih\_l[k]** – the learnable input-hidden bias of the k-th layer,
of shape (hidden\_size)
* ... | large_dataset/raw/docs/pytorch/rnn/rnn_24.md |
31bf50db-689e-520a-bc40-2db9436f7c22 | docs | pytorch | pytorch_rnn | 24 | 7 | There are known non-determinism issues for RNN functions on some versions of cuDNN and CUDA.
You can enforce deterministic behavior by setting the following environment variables:
On CUDA 10.1, set environment variable `CUDA_LAUNCH_BLOCKING=1`.
This may affect performance.
On CUDA 10.2 or later, s... | large_dataset/raw/docs/pytorch/rnn/rnn_24.md |
e2c2e663-7181-58be-a8d6-c1470774e31f | docs | pytorch | pytorch_rnn | 24 | 8 | >>> h0 = torch.randn(2, 3, 20)
>>> output, hn = rnn(input, h0)
```
[Next ](torch.nn.LSTM.html "LSTM")
[ Previous](torch.nn.RNNBase.html "RNNBase")
---
© Copyright 2023, PyTorch Contributors.
Built with [Sphinx]... | large_dataset/raw/docs/pytorch/rnn/rnn_24.md |
db78aa17-b879-559b-b9a0-811f653fff22 | docs | pytorch | pytorch_rnn | 25 | 0 | # RNN¶
Source: https://docs.pytorch.org/docs/2.5/generated/torch.nn.RNN.html
Version: 2.5
*class* torch.nn.RNN(*input\_size*, *hidden\_size*, *num\_layers=1*, *nonlinearity='tanh'*, *bias=True*, *batch\_first=False*, *dropout=0.0*, *bidirectional=False*, *device=None*, *dtype=None*)[[source]](../_modules/torch/nn/mod... | large_dataset/raw/docs/pytorch/rnn/rnn_25.md |
2c41a6b8-79d9-5ed4-a35e-d0b460cbf82b | docs | pytorch | pytorch_rnn | 25 | 1 | If `nonlinearity` is `'relu'`, then ReLU\text{ReLU}ReLU is used instead of tanh\tanhtanh.
```None
# Efficient implementation equivalent to the following with bidirectional=False
def forward(x, h_0=None):
if batch_first:
x = x.transpose(0, 1)
seq_len, batch_size, _ = x.size(... | large_dataset/raw/docs/pytorch/rnn/rnn_25.md |
09d558ab-6d4c-5016-8558-7abb050a9760 | docs | pytorch | pytorch_rnn | 25 | 2 | : * **input\_size** – The number of expected features in the input x
* **hidden\_size** – The number of features in the hidden state h
* **num\_layers** – Number of recurrent layers. E.g., setting `num_layers=2`
would mean stacking two RNNs together to form a stacked RNN,
with ... | large_dataset/raw/docs/pytorch/rnn/rnn_25.md |
a67be7a0-b57a-54dd-8054-65a8c0742747 | docs | pytorch | pytorch_rnn | 25 | 3 | * **dropout** – If non-zero, introduces a Dropout layer on the outputs of each
RNN layer except the last layer, with dropout probability equal to
`dropout`. Default: 0
* **bidirectional** – If `True`, becomes a bidirectional RNN. Default: `False`
Inputs: input, h\_0
: * **... | large_dataset/raw/docs/pytorch/rnn/rnn_25.md |
e572f5e6-35bc-50ba-ad1d-cf00a61067f6 | docs | pytorch | pytorch_rnn | 25 | 4 | * **h\_0**: tensor of shape (D∗num\_layers,Hout)(D \* \text{num\\_layers}, H\_{out})(D∗num\_layers,Hout) for unbatched input or
(D∗num\_layers,N,Hout)(D \* \text{num\\_layers}, N, H\_{out})(D∗num\_layers,N,Hout) containing the initial hidden
state for the input sequence batch. Defaults to ... | large_dataset/raw/docs/pytorch/rnn/rnn_25.md |
dc718174-212c-56aa-a830-09130eff020d | docs | pytorch | pytorch_rnn | 25 | 5 | (L,N,D∗Hout)(L, N, D \* H\_{out})(L,N,D∗Hout) when `batch_first=False` or
(N,L,D∗Hout)(N, L, D \* H\_{out})(N,L,D∗Hout) when `batch_first=True` containing the output features
(h\_t) from the last layer of the RNN, for each t. If a
[`torch.nn.utils.rnn.PackedSequence`](torch.nn.... | large_dataset/raw/docs/pytorch/rnn/rnn_25.md |
4efdf6fc-03b8-57f5-b3df-3ce450e805be | docs | pytorch | pytorch_rnn | 25 | 6 | (hidden\_size, num\_directions \* hidden\_size)
* **weight\_hh\_l[k]** – the learnable hidden-hidden weights of the k-th layer,
of shape (hidden\_size, hidden\_size)
* **bias\_ih\_l[k]** – the learnable input-hidden bias of the k-th layer,
of shape (hidden\_size)
* ... | large_dataset/raw/docs/pytorch/rnn/rnn_25.md |
4511f4ac-e042-506f-bc1c-acfb3059a623 | docs | pytorch | pytorch_rnn | 25 | 7 | There are known non-determinism issues for RNN functions on some versions of cuDNN and CUDA.
You can enforce deterministic behavior by setting the following environment variables:
On CUDA 10.1, set environment variable `CUDA_LAUNCH_BLOCKING=1`.
This may affect performance.
On CUDA 10.2 or later, s... | large_dataset/raw/docs/pytorch/rnn/rnn_25.md |
b779a030-dcb0-5c08-ad41-54521e047c0a | docs | pytorch | pytorch_rnn | 25 | 8 | >>> h0 = torch.randn(2, 3, 20)
>>> output, hn = rnn(input, h0)
```
[Next ](torch.nn.LSTM.html "LSTM")
[ Previous](torch.nn.RNNBase.html "RNNBase")
---
© Copyright 2023, PyTorch Contributors.
Built with [Sphinx]... | large_dataset/raw/docs/pytorch/rnn/rnn_25.md |
a1544fe4-f0e4-508e-9b8e-10cfface8de3 | docs | pytorch | pytorch_rnn | 26 | 0 | # RNN¶
Source: https://docs.pytorch.org/docs/2.6/generated/torch.nn.RNN.html
Version: 2.6
*class* torch.nn.RNN(*input\_size*, *hidden\_size*, *num\_layers=1*, *nonlinearity='tanh'*, *bias=True*, *batch\_first=False*, *dropout=0.0*, *bidirectional=False*, *device=None*, *dtype=None*)[[source]](../_modules/torch/nn/mod... | large_dataset/raw/docs/pytorch/rnn/rnn_26.md |
e11e1213-3090-547f-af4f-855c07389665 | docs | pytorch | pytorch_rnn | 26 | 1 | previous layer at time t-1 or the initial hidden state at time 0.
If `nonlinearity` is `'relu'`, then ReLU\text{ReLU}ReLU is used instead of tanh\tanhtanh.
```None
# Efficient implementation equivalent to the following with bidirectional=False
def forward(x, hx=None):
if batch_first:
... | large_dataset/raw/docs/pytorch/rnn/rnn_26.md |
73580e40-0792-59c0-b113-e913830600e2 | docs | pytorch | pytorch_rnn | 26 | 2 | output = output.transpose(0, 1)
return output, h_t
```
Parameters
: * **input\_size** – The number of expected features in the input x
* **hidden\_size** – The number of features in the hidden state h
* **num\_layers** – Number of recurrent layers. E.g., setting `num_l... | large_dataset/raw/docs/pytorch/rnn/rnn_26.md |
7ffdec5a-cad1-5f61-b3bc-9d95c510c5cf | docs | pytorch | pytorch_rnn | 26 | 3 | Inputs/Outputs sections below for details. Default: `False`
* **dropout** – If non-zero, introduces a Dropout layer on the outputs of each
RNN layer except the last layer, with dropout probability equal to
`dropout`. Default: 0
* **bidirectional** – If `True`, becomes a bid... | large_dataset/raw/docs/pytorch/rnn/rnn_26.md |
96b7721f-9efb-5f7a-b83a-f2d7f55a2b41 | docs | pytorch | pytorch_rnn | 26 | 4 | [`torch.nn.utils.rnn.pack_sequence()`](torch.nn.utils.rnn.pack_sequence.html#torch.nn.utils.rnn.pack_sequence "torch.nn.utils.rnn.pack_sequence") for details.
* **hx**: tensor of shape (D∗num\_layers,Hout)(D \* \text{num\\_layers}, H\_{out})(D∗num\_layers,Hout) for unbatched input or
(D∗num... | large_dataset/raw/docs/pytorch/rnn/rnn_26.md |
88850825-b9a8-5079-a777-24ee6b136994 | docs | pytorch | pytorch_rnn | 26 | 5 | Outputs: output, h\_n
: * **output**: tensor of shape (L,D∗Hout)(L, D \* H\_{out})(L,D∗Hout) for unbatched input,
(L,N,D∗Hout)(L, N, D \* H\_{out})(L,N,D∗Hout) when `batch_first=False` or
(N,L,D∗Hout)(N, L, D \* H\_{out})(N,L,D∗Hout) when `batch_first=True` containing the output feature... | large_dataset/raw/docs/pytorch/rnn/rnn_26.md |
7677ee24-ae37-5ec7-b167-31bbb7610206 | docs | pytorch | pytorch_rnn | 26 | 6 | : * **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
(hidden\_size, num\_directions \* hidden\_size)
* **weight\_hh\_l[k]** – the learnable hidden-hidden weights of the k-th layer,
... | large_dataset/raw/docs/pytorch/rnn/rnn_26.md |
fc200e32-a5ec-547d-93cd-f0445963085c | docs | pytorch | pytorch_rnn | 26 | 7 | `batch_first` argument is ignored for unbatched inputs.
Warning
There are known non-determinism issues for RNN functions on some versions of cuDNN and CUDA.
You can enforce deterministic behavior by setting the following environment variables:
On CUDA 10.1, set environment variable `CUDA_LAUNCH_B... | large_dataset/raw/docs/pytorch/rnn/rnn_26.md |
c6b422a2-8695-5423-bea9-20d0faaf2b7c | docs | pytorch | pytorch_rnn | 26 | 8 | >>> rnn = nn.RNN(10, 20, 2)
>>> input = torch.randn(5, 3, 10)
>>> h0 = torch.randn(2, 3, 20)
>>> output, hn = rnn(input, h0)
```
[Next ](torch.nn.LSTM.html "LSTM")
[ Previous](torch.nn.RNNBase.html "RNNBas... | large_dataset/raw/docs/pytorch/rnn/rnn_26.md |
48405661-a215-5669-be2f-dc34e0eefbe6 | docs | pytorch | pytorch_transformer | 20 | 0 | # Transformer¶
Source: https://docs.pytorch.org/docs/2.0/generated/torch.nn.Transformer.html
Version: 2.0
*class* torch.nn.Transformer(*d\_model=512*, *nhead=8*, *num\_encoder\_layers=6*, *num\_decoder\_layers=6*, *dim\_feedforward=2048*, *dropout=0.1*, *activation=<function relu>*, *custom\_encoder=None*, *custom\_d... | large_dataset/raw/docs/pytorch/transformer/transformer_20.md |
48504f9a-72f9-5ef2-a785-4d00f33bc47d | docs | pytorch | pytorch_transformer | 20 | 1 | : * **d\_model** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.11)")) – the number of expected features in the encoder/decoder inputs (default=512).
* **nhead** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.11)")) – the number of heads in the m... | large_dataset/raw/docs/pytorch/transformer/transformer_20.md |
f9091846-4268-57c6-aa8c-981dde9ac581 | docs | pytorch | pytorch_transformer | 20 | 2 | * **dropout** ([*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.11)")) – the dropout value (default=0.1).
* **activation** ([*Union*](https://docs.python.org/3/library/typing.html#typing.Union "(in Python v3.11)")*[*[*str*](https://docs.python.org/3/library/stdtypes.html#s... | large_dataset/raw/docs/pytorch/transformer/transformer_20.md |
6be4ae03-63c1-5f4e-9d2b-6265482f1c38 | docs | pytorch | pytorch_transformer | 20 | 3 | * **custom\_decoder** ([*Optional*](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.11)")*[*[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.11)")*]*) – custom decoder (default=None).
* **layer\_norm\_eps** ([*float*](https://docs.python.org/3/... | large_dataset/raw/docs/pytorch/transformer/transformer_20.md |
08259de9-391a-5273-a4a8-58c071113e37 | docs | pytorch | pytorch_transformer | 20 | 4 | >>> transformer_model = nn.Transformer(nhead=16, num_encoder_layers=12)
>>> src = torch.rand((10, 32, 512))
>>> tgt = torch.rand((20, 32, 512))
>>> out = transformer_model(src, tgt)
```
Note: A full example to apply nn.Transformer module for the word language model is availa... | large_dataset/raw/docs/pytorch/transformer/transformer_20.md |
881892a0-276b-5150-99b1-b44fd87d3f6a | docs | pytorch | pytorch_transformer | 20 | 5 | * **tgt** ([*Tensor*](../tensors.html#torch.Tensor "torch.Tensor")) – the sequence to the decoder (required).
* **src\_mask** ([*Optional*](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.11)")*[*[*Tensor*](../tensors.html#torch.Tensor "torch.Tensor")*]*) – the addit... | large_dataset/raw/docs/pytorch/transformer/transformer_20.md |
8583b46c-5c4e-5187-be39-b89fa3d1fc9a | docs | pytorch | pytorch_transformer | 20 | 6 | * **src\_key\_padding\_mask** ([*Optional*](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.11)")*[*[*Tensor*](../tensors.html#torch.Tensor "torch.Tensor")*]*) – the Tensor mask for src keys per batch (optional).
* **tgt\_key\_padding\_mask** ([*Optional*](https://do... | large_dataset/raw/docs/pytorch/transformer/transformer_20.md |
3596da0a-a79c-56f3-aa27-5944e7db19ee | docs | pytorch | pytorch_transformer | 20 | 7 | (N, S, E) if batch\_first=True.
* tgt: (T,E)(T, E)(T,E) for unbatched input, (T,N,E)(T, N, E)(T,N,E) if batch\_first=False or
(N, T, E) if batch\_first=True.
* src\_mask: (S,S)(S, S)(S,S) or (N⋅num\_heads,S,S)(N\cdot\text{num\\_heads}, S, S)(N⋅num\_heads,S,S).
... | large_dataset/raw/docs/pytorch/transformer/transformer_20.md |
9aca42aa-1ec5-5415-ae83-b2d781dfd05a | docs | pytorch | pytorch_transformer | 20 | 8 | are not allowed to attend while `False` values will be unchanged. If a FloatTensor
is provided, it will be added to the attention weight.
[src/tgt/memory]\_key\_padding\_mask provides specified elements in the key to be ignored by
the attention. If a BoolTensor is provide... | large_dataset/raw/docs/pytorch/transformer/transformer_20.md |
4e6d225c-4485-58b8-97c4-71b031f74d7b | docs | pytorch | pytorch_transformer | 20 | 9 | >>> output = transformer_model(src, tgt, src_mask=src_mask, tgt_mask=tgt_mask)
```
*static* generate\_square\_subsequent\_mask(*sz*, *device='cpu'*)[[source]](../_modules/torch/nn/modules/transformer.html#Transformer.generate_square_subsequent_mask)[¶](#torch.nn.Transformer.generate_square_subseque... | large_dataset/raw/docs/pytorch/transformer/transformer_20.md |
00be327e-2ad7-5fa4-bdf7-5bba00e2c493 | docs | pytorch | pytorch_transformer | 21 | 0 | # Transformer¶
Source: https://docs.pytorch.org/docs/2.1/generated/torch.nn.Transformer.html
Version: 2.1
*class* torch.nn.Transformer(*d\_model=512*, *nhead=8*, *num\_encoder\_layers=6*, *num\_decoder\_layers=6*, *dim\_feedforward=2048*, *dropout=0.1*, *activation=<function relu>*, *custom\_encoder=None*, *custom\_d... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
41f82209-adbd-551a-819f-c070baf6b5ac | docs | pytorch | pytorch_transformer | 21 | 1 | : * **d\_model** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")) – the number of expected features in the encoder/decoder inputs (default=512).
* **nhead** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")) – the number of heads in the m... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
da54fc93-e3ac-5ab4-83a3-bafb9d445334 | docs | pytorch | pytorch_transformer | 21 | 2 | * **dropout** ([*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.12)")) – the dropout value (default=0.1).
* **activation** ([*Union*](https://docs.python.org/3/library/typing.html#typing.Union "(in Python v3.12)")*[*[*str*](https://docs.python.org/3/library/stdtypes.html#s... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
6e3948c0-c0d1-5c84-9320-c68cef19736f | docs | pytorch | pytorch_transformer | 21 | 3 | * **custom\_decoder** ([*Optional*](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.12)")*[*[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)")*]*) – custom decoder (default=None).
* **layer\_norm\_eps** ([*float*](https://docs.python.org/3/... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
9480d723-3a06-5e6d-9ff2-e4a26e1e1c8d | docs | pytorch | pytorch_transformer | 21 | 4 | * **bias** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")) – If set to `False`, `Linear` and `LayerNorm` layers will not learn an additive
bias. Default: `True`.
Examples::
: ```None
>>> transformer_model = nn.Transformer(nhead=16, num_encoder_l... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
29440245-abef-522e-9bee-604b1c01925a | docs | pytorch | pytorch_transformer | 21 | 5 | forward(*src*, *tgt*, *src\_mask=None*, *tgt\_mask=None*, *memory\_mask=None*, *src\_key\_padding\_mask=None*, *tgt\_key\_padding\_mask=None*, *memory\_key\_padding\_mask=None*, *src\_is\_causal=None*, *tgt\_is\_causal=None*, *memory\_is\_causal=False*)[[source]](../_modules/torch/nn/modules/transformer.html#Transf... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
353d7692-f6a9-500d-9f77-39ff1992aa58 | docs | pytorch | pytorch_transformer | 21 | 6 | * **tgt\_mask** ([*Optional*](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.12)")*[*[*Tensor*](../tensors.html#torch.Tensor "torch.Tensor")*]*) – the additive mask for the tgt sequence (optional).
* **memory\_mask** ([*Optional*](https://docs.python.org/3/library/t... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
b4eeefe9-5ae6-5e57-84e2-fb1f6ec2c131 | docs | pytorch | pytorch_transformer | 21 | 7 | * **memory\_key\_padding\_mask** ([*Optional*](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.12)")*[*[*Tensor*](../tensors.html#torch.Tensor "torch.Tensor")*]*) – the Tensor mask for memory keys per batch (optional).
* **src\_is\_causal** ([*Optional*](https://docs... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
0f5e8dd5-9a64-5aa4-94a4-01d1339da0b5 | docs | pytorch | pytorch_transformer | 21 | 8 | * **tgt\_is\_causal** ([*Optional*](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.12)")*[*[*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*]*) – If specified, applies a causal mask as `tgt_mask`.
Default: `None`; try to detect a... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
8c4b8dcb-8e23-59dc-9ebe-92fdf2ef2fa1 | docs | pytorch | pytorch_transformer | 21 | 9 | forward and backward compatibility.
Return type
: [*Tensor*](../tensors.html#torch.Tensor "torch.Tensor")
Shape:
: * src: (S,E)(S, E)(S,E) for unbatched input, (S,N,E)(S, N, E)(S,N,E) if batch\_first=False or
(N, S, E) if batch\_first=True.
*... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
19589e71-583b-51bf-9055-3159eb2d0836 | docs | pytorch | pytorch_transformer | 21 | 10 | * memory\_key\_padding\_mask: (S)(S)(S) for unbatched input otherwise (N,S)(N, S)(N,S).
Note: [src/tgt/memory]\_mask ensures that position i is allowed to attend the unmasked
positions. If a BoolTensor is provided, positions with `True`
are not allowed to attend while `F... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
7c66ccf1-4896-5f95-a5ef-75ad82ad4ee3 | docs | pytorch | pytorch_transformer | 21 | 11 | the output sequence length of a transformer is same as the input sequence
(i.e. target) length of the decoder.
where S is the source sequence length, T is the target sequence length, N is the
batch size, E is the feature number
Examples
```None
... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
666f90cc-f5ce-534c-85a9-aa39ab99476f | docs | pytorch | pytorch_transformer | 21 | 12 | [Next ](torch.nn.TransformerEncoder.html "TransformerEncoder")
[ Previous](torch.nn.GRUCell.html "GRUCell")
---
© Copyright 2023, PyTorch Contributors.
Built with [Sphinx](http://sphinx-doc.org/) using a [theme](https://git... | large_dataset/raw/docs/pytorch/transformer/transformer_21.md |
1aa58eea-5f21-5931-b718-0c3f56c208a5 | docs | pytorch | pytorch_transformer | 22 | 0 | # Transformer¶
Source: https://docs.pytorch.org/docs/2.2/generated/torch.nn.Transformer.html
Version: 2.2
*class* torch.nn.Transformer(*d\_model=512*, *nhead=8*, *num\_encoder\_layers=6*, *num\_decoder\_layers=6*, *dim\_feedforward=2048*, *dropout=0.1*, *activation=<function relu>*, *custom\_encoder=None*, *custom\_d... | large_dataset/raw/docs/pytorch/transformer/transformer_22.md |
eb5a5cb0-3612-58b6-ba72-12e2e29335aa | docs | pytorch | pytorch_transformer | 22 | 1 | : * **d\_model** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")) – the number of expected features in the encoder/decoder inputs (default=512).
* **nhead** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")) – the number of heads in the m... | large_dataset/raw/docs/pytorch/transformer/transformer_22.md |
b0485b3e-82b1-5921-ac22-3a0e80d38248 | docs | pytorch | pytorch_transformer | 22 | 2 | * **dropout** ([*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.12)")) – the dropout value (default=0.1).
* **activation** ([*Union*](https://docs.python.org/3/library/typing.html#typing.Union "(in Python v3.12)")*[*[*str*](https://docs.python.org/3/library/stdtypes.html#s... | large_dataset/raw/docs/pytorch/transformer/transformer_22.md |
a00293ff-c1f8-59fd-8dd7-12af650f94ba | docs | pytorch | pytorch_transformer | 22 | 3 | * **custom\_decoder** ([*Optional*](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.12)")*[*[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.12)")*]*) – custom decoder (default=None).
* **layer\_norm\_eps** ([*float*](https://docs.python.org/3/... | large_dataset/raw/docs/pytorch/transformer/transformer_22.md |
4ffb0695-46eb-5fe4-9d78-87c879c73875 | docs | pytorch | pytorch_transformer | 22 | 4 | * **bias** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")) – If set to `False`, `Linear` and `LayerNorm` layers will not learn an additive
bias. Default: `True`.
Examples::
: ```None
>>> transformer_model = nn.Transformer(nhead=16, num_encoder_l... | large_dataset/raw/docs/pytorch/transformer/transformer_22.md |
7eab0a34-57ca-5637-8330-af2436fb2a55 | docs | pytorch | pytorch_transformer | 22 | 5 | forward(*src*, *tgt*, *src\_mask=None*, *tgt\_mask=None*, *memory\_mask=None*, *src\_key\_padding\_mask=None*, *tgt\_key\_padding\_mask=None*, *memory\_key\_padding\_mask=None*, *src\_is\_causal=None*, *tgt\_is\_causal=None*, *memory\_is\_causal=False*)[[source]](../_modules/torch/nn/modules/transformer.html#Transf... | large_dataset/raw/docs/pytorch/transformer/transformer_22.md |
da55b778-b2b0-5bf4-804c-74499e18b562 | docs | pytorch | pytorch_transformer | 22 | 6 | * **tgt\_mask** ([*Optional*](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.12)")*[*[*Tensor*](../tensors.html#torch.Tensor "torch.Tensor")*]*) – the additive mask for the tgt sequence (optional).
* **memory\_mask** ([*Optional*](https://docs.python.org/3/library/t... | large_dataset/raw/docs/pytorch/transformer/transformer_22.md |
356b0a7d-6f75-586b-bffa-24e7bd11830e | docs | pytorch | pytorch_transformer | 22 | 7 | * **memory\_key\_padding\_mask** ([*Optional*](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.12)")*[*[*Tensor*](../tensors.html#torch.Tensor "torch.Tensor")*]*) – the Tensor mask for memory keys per batch (optional).
* **src\_is\_causal** ([*Optional*](https://docs... | large_dataset/raw/docs/pytorch/transformer/transformer_22.md |
60cc69bb-2944-5204-960c-775734877607 | docs | pytorch | pytorch_transformer | 22 | 8 | * **tgt\_is\_causal** ([*Optional*](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.12)")*[*[*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")*]*) – If specified, applies a causal mask as `tgt_mask`.
Default: `None`; try to detect a... | large_dataset/raw/docs/pytorch/transformer/transformer_22.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.