class_docstr: Simple model to use for testing. We use an encoder-decoder architecture with tied
  embeddings to make sure we cover enough edge cases.
class_docstr_tok: ["Simple","model","to","use","for","testing",".","We","use","an","encoder-decoder","architecture","with","tied","embeddings","to","make","sure","we","cover","enough","edge","cases","."]
docstr: Should be called after loading state dict to make sure embedding weigths are tied.
docstr_tok: ["Should","be","called","after","loading","state","dict","to","make","sure","embedding","weigths","are","tied","."]
code: def tie_weights(self):
      """
      Should be called after loading state dict to make sure embedding weigths are tied.
      """
      self.decoder.linear.weight = self.embedding.weight
  
imports: import os
  from os import PathLike
  from typing import Union, Dict, Optional
  import torch
  from torch.cuda import amp
  from torch.testing import assert_allclose
  import pytest
  from allennlp.common.testing import AllenNlpTestCase, run_distributed_test, requires_multi_gpu
  from allennlp.nn.util import load_state_dict_distributed
  from allennlp.nn.parallel import FairScaleFsdpAccelerator, FairScaleFsdpWrappedModel, ShardedModuleMixin
label_desc: Use image node_id 2 for calling the EncoderDecoderModel obj's underlying member method code with example usage: obj.tie_weights() without return types