code: def __init__(
      self,
      model_dim,
      num_global_experts,
      k=1,
      fp32_gate=False,
      **options,
  ):
      super().__init__()
      try:
          self.wg = torch.nn.Linear(
              model_dim,
              num_global_experts,
              bias=False,
              dtype=torch.float32 if fp32_gate else None,
          )
      except:
          self.wg = torch.nn.Linear(
              model_dim, num_global_experts, bias=False
          )
      self.top_k = min(num_global_experts, int(k))
      self.fp32_gate = fp32_gate
  
      for opt in options:
          if opt not in ("capacity_factor", "gate_noise"):
              raise Exception(
                  "Unrecognized argument provided to Gating module: %s"
                  % opt
              )
  
imports: import torch
label_desc: Use image node_id 1 to create a new LinearTopKGate object from inherited base classes: torch.nn with example: obj = LinearTopKGate(model_dim, num_global_experts, k, fp32_gate)