class_docstr: Class that takes a partially input convex neural network (picnn)
  as input and equips it with functions of logdet
  computation (both estimation and exact computation)
  
  This class is based on DeepConvexFlow of the CP-Flow
  repo (https://github.com/CW-Huang/CP-Flow)
  
  For details of the logdet estimator, see
  ``Convex potential flows: Universal probability distributions
  with optimal transport and convex optimization``
  
  Parameters
  ----------
  picnn
      A partially input convex neural network (picnn)
  dim
      Dimension of the input
  is_energy_score
      Indicates if energy score is used as the objective function
      If yes, the network is not required to be strictly convex,
      so we can just use the picnn
      otherwise, a quadratic term is added to the output of picnn
      to render it strictly convex
  m1
      Dimension of the Krylov subspace of the Lanczos tridiagonalization
      used in approximating H of logdet(H)
  m2
      Iteration number of the conjugate gradient algorithm
      used to approximate logdet(H)
  rtol
      relative tolerance of the conjugate gradient algorithm
  atol
      absolute tolerance of the conjugate gradient algorithm
class_docstr_tok: ["Class","that","takes","a","partially","input","convex","neural","network","(","picnn",")","as","input","and","equips","it","with","functions","of","logdet","computation","(","both","estimation","and","exact","computation",")","This","class","is","based","on","DeepConvexFlow","of","the","CP-Flow","repo","(","https",":","\/\/github.com\/CW-Huang\/CP-Flow",")","For","details","of","the","logdet","estimator",",","see","``","Convex","potential","flows",":","Universal","probability","distributions","with","optimal","transport","and","convex","optimization","``","Parameters","--","--","--","--","--","picnn","A","partially","input","convex","neural","network","(","picnn",")","dim","Dimension","of","the","input","is_energy_score","Indicates","if","energy","score","is","used","as","the","objective","function","If","yes",",","the","network","is","not","required","to","be","strictly","convex",",","so","we","can","just","use","the","picnn","otherwise",",","a","quadratic","term","is","added","to","the","output","of","picnn","to","render","it","strictly","convex","m1","Dimension","of","the","Krylov","subspace","of","the","Lanczos","tridiagonalization","used","in","approximating","H","of","logdet","(","H",")","m2","Iteration","number","of","the","conjugate","gradient","algorithm","used","to","approximate","logdet","(","H",")","rtol","relative","tolerance","of","the","conjugate","gradient","algorithm","atol","absolute","tolerance","of","the","conjugate","gradient","algorithm"]
code: def forward_transform(
      self,
      x: torch.Tensor,
      logdet: Optional[Union[float, torch.Tensor]] = 0.0,
      context: Optional[torch.Tensor] = None,
      extra: Optional[torch.Tensor] = None,
  ) -> Union[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]:
      if self.estimate_logdet:
          return self.forward_transform_stochastic(
              x, logdet, context=context, extra=extra
          )
      else:
          return self.forward_transform_bruteforce(
              x, logdet, context=context
          )
  
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 DeepConvexNet obj's underlying member method code with example usage: obj.forward_transform(x, logdet, context, extra) and returns: self, self