class_docstr: Call a Sparsely gated mixture of experts layer with 1-layer Feed-Forward networks as experts.
  Args:
  input_size: integer - size of the input
  output_size: integer - size of the input
  num_experts: an integer - number of experts
  hidden_size: an integer - hidden size of the experts
  noisy_gating: a boolean
  k: an integer - how many experts to use for each batch element
class_docstr_tok: ["Call","a","Sparsely","gated","mixture","of","experts","layer","with","1-layer","Feed-Forward","networks","as","experts",".","Args",":","input_size",":","integer","-","size","of","the","input","output_size",":","integer","-","size","of","the","input","num_experts",":","an","integer","-","number","of","experts","hidden_size",":","an","integer","-","hidden","size","of","the","experts","noisy_gating",":","a","boolean","k",":","an","integer","-","how","many","experts","to","use","for","each","batch","element"]
docstr: The squared coefficient of variation of a sample.
  Useful as a loss to encourage a positive distribution to be more uniform.
  Epsilons added for numerical stability.
  Returns 0 for an empty Tensor.
  Args:
  x: a `Tensor`.
  Returns:
  a `Scalar`.
docstr_tok: ["The","squared","coefficient","of","variation","of","a","sample",".","Useful","as","a","loss","to","encourage","a","positive","distribution","to","be","more","uniform",".","Epsilons","added","for","numerical","stability",".","Returns","0","for","an","empty","Tensor",".","Args",":","x",":","a","`","Tensor","`",".","Returns",":","a","`","Scalar","`","."]
code: def cv_squared(self, x):
      """The squared coefficient of variation of a sample.
      Useful as a loss to encourage a positive distribution to be more uniform.
      Epsilons added for numerical stability.
      Returns 0 for an empty Tensor.
      Args:
      x: a `Tensor`.
      Returns:
      a `Scalar`.
      """
      eps = 1e-10
      # if only num_experts = 1
  
      if x.shape[0] == 1:
          return torch.tensor([0], device=x.device, dtype=x.dtype)
      return x.float().var() / (x.float().mean() ** 2 + eps)
  
imports: import torch
  import torch.nn
  from torch.distributions.normal import Normal
  import numpy
label_desc: Use image node_id 2 for calling the MoE obj's underlying member method code with example usage: obj.cv_squared(x) and returns: unknown, torch