class_docstr: FastFlow Loss.
class_docstr_tok: ["FastFlow","Loss","."]
docstr: Calculate the Fastflow loss.
  
  Args:
      hidden_variables (list[Tensor]): Hidden variables from the fastflow model. f: X -> Z
      jacobians (list[Tensor]): Log of the jacobian determinants from the fastflow model.
  
  Returns:
      Tensor: Fastflow loss computed based on the hidden variables and the log of the Jacobians.
docstr_tok: ["Calculate","the","Fastflow","loss",".","Args",":","hidden_variables","(","list","[","Tensor","]",")",":","Hidden","variables","from","the","fastflow","model",".","f",":","X","-",">","Z","jacobians","(","list","[","Tensor","]",")",":","Log","of","the","jacobian","determinants","from","the","fastflow","model",".","Returns",":","Tensor",":","Fastflow","loss","computed","based","on","the","hidden","variables","and","the","log","of","the","Jacobians","."]
code: def forward(
      self, hidden_variables: list[Tensor], jacobians: list[Tensor]
  ) -> Tensor:
      """Calculate the Fastflow loss.
  
      Args:
          hidden_variables (list[Tensor]): Hidden variables from the fastflow model. f: X -> Z
          jacobians (list[Tensor]): Log of the jacobian determinants from the fastflow model.
  
      Returns:
          Tensor: Fastflow loss computed based on the hidden variables and the log of the Jacobians.
      """
      loss = torch.tensor(
          0.0, device=hidden_variables[0].device
      )  # pylint: disable=not-callable
      for hidden_variable, jacobian in zip(hidden_variables, jacobians):
          loss += torch.mean(
              0.5 * torch.sum(hidden_variable**2, dim=(1, 2, 3))
              - jacobian
          )
      return loss
  
imports: from __future__ import annotations
  import torch
  from torch import Tensor, nn
label_desc: Use image node_id 1 for calling the FastflowLoss obj's underlying member method code with example usage: obj.forward(hidden_variables, jacobians) and returns: loss