class_docstr: Abstract module for Stochastic Gates.
  
  Stochastic Gates is a practical solution to add L0 norm regularization for neural
  networks. L0 regularization, which explicitly penalizes any present (non-zero)
  parameters, can help network pruning and feature selection, but directly optimizing
  L0 is a non-differentiable combinatorial problem. To surrogate L0, Stochastic Gate
  uses certain continuous probability distributions (e.g., Concrete, Gaussian) with
  hard-sigmoid rectification as a continuous smoothed Bernoulli distribution
  determining the weight of a parameter, i.e., gate. Then L0 is equal to the gates's
  non-zero probability represented by the parameters of the continuous probability
  distribution. The gate value can also be reparameterized to the distribution
  parameters with a noise. So the expected L0 can be optimized through learning
  the distribution parameters via stochastic gradients.
  
  This base class defines the shared variables and forward logic of how the input is
  gated regardless of the underneath distribution. The actual implementation should
  extend this class and implement the distribution specific functions.
docstr: Get the gate values, which are the means of the underneath gate distributions,
  optionally clamped within 0 and 1.
  
  Args:
      clamp (bool, optional): whether to clamp the gate values or not. As smoothed
          Bernoulli variables, gate values are clamped within 0 and 1 by default.
          Turn this off to get the raw means of the underneath
          distribution (e.g., concrete, gaussian), which can be useful to
          differentiate the gates' importance when multiple gate
          values are beyond 0 or 1.
          Default: ``True``
  
  Returns:
      Tensor:
      - gate_values (Tensor): value of each gate in shape(n_gates)
docstr_tok: ["Get","the","gate","values",",","which","are","the","means","of","the","underneath","gate","distributions",",","optionally","clamped","within","0","and","1",".","Args",":","clamp","(","bool",",","optional",")",":","whether","to","clamp","the","gate","values","or","not",".","As","smoothed","Bernoulli","variables",",","gate","values","are","clamped","within","0","and","1","by","default",".","Turn","this","off","to","get","the","raw","means","of","the","underneath","distribution","(","e.g.",",","concrete",",","gaussian",")",",","which","can","be","useful","to","differentiate","the","gates","'","importance","when","multiple","gate","values","are","beyond","0","or","1",".","Default",":","``","True","``","Returns",":","Tensor",":","-","gate_values","(","Tensor",")",":","value","of","each","gate","in","shape","(","n_gates",")"]
code: def get_gate_values(self, clamp: bool = True) -> Tensor:
      """
      Get the gate values, which are the means of the underneath gate distributions,
      optionally clamped within 0 and 1.
  
      Args:
          clamp (bool, optional): whether to clamp the gate values or not. As smoothed
              Bernoulli variables, gate values are clamped within 0 and 1 by default.
              Turn this off to get the raw means of the underneath
              distribution (e.g., concrete, gaussian), which can be useful to
              differentiate the gates' importance when multiple gate
              values are beyond 0 or 1.
              Default: ``True``
  
      Returns:
          Tensor:
          - gate_values (Tensor): value of each gate in shape(n_gates)
      """
      gate_values = self._get_gate_values()
      if clamp:
          gate_values = torch.clamp(gate_values, min=0, max=1)
  
      return gate_values.detach()
  
file_path: captum/captum/module/stochastic_gates_base.py
imports: from abc import ABC, abstractmethod
  from typing import Optional, Tuple
  import torch
  from torch import Tensor
  from torch.nn import Module
label_desc: Use image node_id 3 for calling the StochasticGatesBase obj's underlying member method code with example usage: obj.get_gate_values(clamp) and returns: gate_values