code: def forward(
      self,
      code: torch.Tensor,
      speaker_id: int = 0,
      style_id: int = 0,
      f0: torch.Tensor = None,
      dur_prediction: bool = False,
  ) -> torch.Tensor:
      x = dict()
      x["code"] = code
      if self.model.multispkr:
          x["spkr"] = (
              torch.LongTensor([speaker_id]).view(1, 1).to(code.device)
          )
      if self.model.multistyle:
          x["style"] = (
              torch.LongTensor([style_id]).view(1, 1).to(code.device)
          )
      if self.model.f0:
          assert f0 is not None
          x["f0"] = f0.to(code.device)
  
      x["dur_prediction"] = dur_prediction
      if dur_prediction:
          assert (
              self.model.dur_predictor is not None
          ), "This CodeHiFiGAN model doesn't support duration prediction!"
  
      # remove invalid code
      mask = x["code"] >= 0
      x["code"] = x["code"][mask].unsqueeze(dim=0)
      if "f0" in x:
          f0_up_ratio = x["f0"].size(1) // x["code"].size(1)
          mask = (
              mask.unsqueeze(2)
              .repeat(1, 1, f0_up_ratio)
              .view(-1, x["f0"].size(1))
          )
          x["f0"] = x["f0"][mask].unsqueeze(dim=0)
  
      return self.model(**x).detach().squeeze()
  
file_path: textlesslib/textless/vocoders/hifigan/vocoder.py
imports: import torch
  import torch.nn
  import numpy
  from .generator import CodeGenerator
  import json
  from typing import Union
  from pathlib import Path
  from textless.checkpoint_manager import CHECKPOINT_MANAGER
label_desc: Use image node_id 2 for calling the CodeHiFiGANVocoder obj's underlying member method code with example usage: obj.forward(code, speaker_id, style_id, f0, dur_prediction) and returns: self