class_docstr: Class that combines a list of DeepConvexNet and ActNorm
  layers and provides energy score computation
  
  This class is based on SequentialFlow of the CP-Flow repo
  (https://github.com/CW-Huang/CP-Flow)
  
  Parameters
  ----------
  networks
      list of DeepConvexNet and/or ActNorm instances
class_docstr_tok: ["Class","that","combines","a","list","of","DeepConvexNet","and","ActNorm","layers","and","provides","energy","score","computation","This","class","is","based","on","SequentialFlow","of","the","CP-Flow","repo","(","https",":","\/\/github.com\/CW-Huang\/CP-Flow",")","Parameters","--","--","--","--","--","networks","list","of","DeepConvexNet","and\/or","ActNorm","instances"]
docstr: Auxiliary function for energy score computation Drawing samples
  conditioned on the hidden state.
  
  Parameters
  ----------
  hidden_state
      hidden_state which the samples conditioned
      on (num_samples, hidden_size)
  dimension
      dimension of the input
  
  Returns
  -------
  samples
      samples drawn (num_samples, dimension)
docstr_tok: ["Auxiliary","function","for","energy","score","computation","Drawing","samples","conditioned","on","the","hidden","state",".","Parameters","--","--","--","--","--","hidden_state","hidden_state","which","the","samples","conditioned","on","(","num_samples",",","hidden_size",")","dimension","dimension","of","the","input","Returns","--","--","--","-","samples","samples","drawn","(","num_samples",",","dimension",")"]
code: def es_sample(
      self, hidden_state: torch.Tensor, dimension: int
  ) -> torch.Tensor:
      """
      Auxiliary function for energy score computation Drawing samples
      conditioned on the hidden state.
  
      Parameters
      ----------
      hidden_state
          hidden_state which the samples conditioned
          on (num_samples, hidden_size)
      dimension
          dimension of the input
  
      Returns
      -------
      samples
          samples drawn (num_samples, dimension)
      """
  
      num_samples = hidden_state.shape[0]
  
      zero = torch.tensor(
          0, dtype=hidden_state.dtype, device=hidden_state.device
      )
      one = torch.ones_like(zero)
      standard_normal = Normal(zero, one)
  
      samples = self.forward(
          standard_normal.sample([num_samples * dimension]).view(
              num_samples, dimension
          ),
          context=hidden_state,
      )
  
      return samples
  
file_path: gluonts/src/gluonts/torch/model/mqf2/icnn_utils.py
imports: from typing import Optional, Tuple, List, Union
  from cpflows.flows import SequentialFlow, DeepConvexFlow
  import torch
  import torch.nn.functional
  from torch.distributions.normal import Normal
label_desc: Use image node_id 3 for calling the SequentialNet obj's underlying member method code with example usage: obj.es_sample(hidden_state, dimension) and returns: samples