700abc65fd2172a2c6809dd9b72cf50fc2407772,allennlp/models/encoder_decoders/composed_seq2seq.py,ComposedSeq2Seq,__init__,#ComposedSeq2Seq#Any#Any#Any#Any#Any#Any#Any#,48
Before Change
)
source_embedder = self._source_text_embedder._token_embedders[tied_source_embedder_key]
if not isinstance(source_embedder, Embedding):
raise ConfigurationError(
"Unable to tie embeddings,"
"Selected source embedder is not an instance of `Embedding`."
)
if source_embedder.get_output_dim() != self._decoder.target_embedder.get_output_dim():
raise ConfigurationError(
f"Output Dimensions mismatch between" f"source embedder and target embedder."
)
self._source_text_embedder._token_embedders[
tied_source_embedder_key
] = self._decoder.target_embedder
initializer(self)
@overrides
def forward(
After Change
encoder: Seq2SeqEncoder,
decoder: SeqDecoder,
tied_source_embedder_key: Optional[str] = None,
initializer: InitializerApplicator = InitializerApplicator(),
**kwargs,
) -> None:
super().__init__(vocab, **kwargs)
self._source_text_embedder = source_text_embedder
self._encoder = encoder
self._decoder = decoder
if self._encoder.get_output_dim() != self._decoder.get_output_dim():
raise ConfigurationError(
f"Encoder output dimension {self._encoder.get_output_dim()} should be"
f" equal to decoder dimension {self._decoder.get_output_dim()}."
)
if tied_source_embedder_key:
// A bit of a ugly hack to tie embeddings.
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: allenai/allennlp
Commit Name: 700abc65fd2172a2c6809dd9b72cf50fc2407772
Time: 2020-02-03
Author: mattg@allenai.org
File Name: allennlp/models/encoder_decoders/composed_seq2seq.py
Class Name: ComposedSeq2Seq
Method Name: __init__
Project Name: microsoft/nni
Commit Name: 6126960c57919dc71237609c76c2d0449834c24c
Time: 2020-10-10
Author: 38930155+chicm-ms@users.noreply.github.com
File Name: examples/model_compress/amc/amc_search.py
Class Name:
Method Name: get_model_and_checkpoint
Project Name: shenweichen/DeepCTR
Commit Name: 8182ea386e6529a1a2294d8e2d33fc040d0cbfb2
Time: 2019-07-21
Author: wcshen1994@163.com
File Name: deepctr/inputs.py
Class Name:
Method Name: get_linear_logit