zeshengzong 2025-04-11 02:31:56 +00:00 committed by PyTorch MergeBot
parent 1e92579126
commit 4b0cf9fc00

View File

@ -314,6 +314,10 @@ class TransformerEncoder(Module):
Users can build the BERT(https://arxiv.org/abs/1810.04805) model with corresponding parameters.
.. warning::
All layers in the TransformerEncoder are initialized with the same parameters.
It is recommended to manually initialize the layers after creating the TransformerEncoder instance.
Args:
encoder_layer: an instance of the TransformerEncoderLayer() class (required).
num_layers: the number of sub-encoder-layers in the encoder (required).
@ -535,6 +539,10 @@ class TransformerDecoder(Module):
for an in depth discussion of the performant building blocks PyTorch offers for building your own
transformer layers.
.. warning::
All layers in the TransformerDecoder are initialized with the same parameters.
It is recommended to manually initialize the layers after creating the TransformerDecoder instance.
Args:
decoder_layer: an instance of the TransformerDecoderLayer() class (required).
num_layers: the number of sub-decoder-layers in the decoder (required).