class_docstr: Flip flow module.
class_docstr_tok: ["Flip","flow","module","."]
docstr: Calculate forward propagation.
  
  Args:
      x (Tensor): Input tensor (B, channels, T).
      inverse (bool): Whether to inverse the flow.
  
  Returns:
      Tensor: Flipped tensor (B, channels, T).
      Tensor: Log-determinant tensor for NLL (B,) if not inverse.
docstr_tok: ["Calculate","forward","propagation",".","Args",":","x","(","Tensor",")",":","Input","tensor","(","B",",","channels",",","T",")",".","inverse","(","bool",")",":","Whether","to","inverse","the","flow",".","Returns",":","Tensor",":","Flipped","tensor","(","B",",","channels",",","T",")",".","Tensor",":","Log-determinant","tensor","for","NLL","(","B",",",")","if","not","inverse","."]
code: def forward(
      self, x: torch.Tensor, *args, inverse: bool = False, **kwargs
  ) -> Union[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]:
      """Calculate forward propagation.
  
      Args:
          x (Tensor): Input tensor (B, channels, T).
          inverse (bool): Whether to inverse the flow.
  
      Returns:
          Tensor: Flipped tensor (B, channels, T).
          Tensor: Log-determinant tensor for NLL (B,) if not inverse.
  
      """
      x = torch.flip(x, [1])
      if not inverse:
          logdet = x.new_zeros(x.size(0))
          return x, logdet
      else:
          return x
  
imports: import math
  from typing import Optional, Tuple, Union
  import torch
  from espnet2.gan_tts.vits.transform import piecewise_rational_quadratic_transform
label_desc: Use image node_id 1 for calling the FlipFlow obj's underlying member method code with example usage: obj.forward(x) and returns: x,  logdet, x