class_docstr: Temporal Convolutional Network block.
  
  Composed sequentially of two causal convolutions (with leaky ReLU activation functions),
  and a parallel residual connection.
  
  Takes as input a three-dimensional tensor (`B`, `C`, `L`) where `B` is the
  batch size, `C` is the number of input channels, and `L` is the length of
  the input. Outputs a three-dimensional tensor (`B`, `C`, `L`).
  
  Args:
      in_channels : Number of input channels.
      out_channels : Number of output channels.
      kernel_size : Kernel size of the applied non-residual convolutions.
      dilation : Dilation parameter of non-residual convolutions.
      bias : If True, adds a learnable bias to the convolutions.
      fwd_time : If True, the network "causal" direction is from past to future (forward),
          if False, the relation is from future to past (backward).
      final : If True, the last activation function is disabled.
class_docstr_tok: ["Temporal","Convolutional","Network","block",".","Composed","sequentially","of","two","causal","convolutions","(","with","leaky","ReLU","activation","functions",")",",","and","a","parallel","residual","connection",".","Takes","as","input","a","three-dimensional","tensor","(","`","B","`",",","`","C","`",",","`","L","`",")","where","`","B","`","is","the","batch","size",",","`","C","`","is","the","number","of","input","channels",",","and","`","L","`","is","the","length","of","the","input",".","Outputs","a","three-dimensional","tensor","(","`","B","`",",","`","C","`",",","`","L","`",")",".","Args",":","in_channels",":","Number","of","input","channels",".","out_channels",":","Number","of","output","channels",".","kernel_size",":","Kernel","size","of","the","applied","non-residual","convolutions",".","dilation",":","Dilation","parameter","of","non-residual","convolutions",".","bias",":","If","True",",","adds","a","learnable","bias","to","the","convolutions",".","fwd_time",":","If","True",",","the","network","``","causal","''","direction","is","from","past","to","future","(","forward",")",",","if","False",",","the","relation","is","from","future","to","past","(","backward",")",".","final",":","If","True",",","the","last","activation","function","is","disabled","."]
code: def __init__(
      self,
      in_channels: int,
      out_channels: int,
      kernel_size: int,
      dilation: int,
      bias: bool = True,
      fwd_time: bool = True,
      final: bool = False,
  ):
      super().__init__()
  
      in_channels = int(in_channels)
      kernel_size = int(kernel_size)
      out_channels = int(out_channels)
      dilation = int(dilation)
  
      # Computes left padding so that the applied convolutions are causal
      padding = int((kernel_size - 1) * dilation)
  
      # First causal convolution
      conv1_pre = torch.nn.Conv1d(
          in_channels=in_channels,
          out_channels=out_channels,
          kernel_size=kernel_size,
          padding=padding,
          dilation=dilation,
          bias=bias,
      )
      conv1 = torch.nn.utils.weight_norm(conv1_pre)
  
      # The truncation makes the convolution causal
      chomp1 = Chomp1d(chomp_size=padding, last=fwd_time)
  
      relu1 = torch.nn.LeakyReLU()
  
      # Second causal convolution
      conv2_pre = torch.nn.Conv1d(
          in_channels=out_channels,
          out_channels=out_channels,
          kernel_size=kernel_size,
          padding=padding,
          dilation=dilation,
          bias=bias,
      )
      conv2 = torch.nn.utils.weight_norm(conv2_pre)
      chomp2 = Chomp1d(padding)
      relu2 = torch.nn.LeakyReLU()
  
      # Causal network
      self.causal = torch.nn.Sequential(
          conv1, chomp1, relu1, conv2, chomp2, relu2
      )
  
      # Residual connection
      self.upordownsample = (
          torch.nn.Conv1d(
              in_channels=in_channels,
              out_channels=out_channels,
              kernel_size=1,
          )
          if in_channels != out_channels
          else None
      )
  
      # Final activation function
      self.activation = torch.nn.LeakyReLU() if final else None
  
file_path: gluonts/src/gluonts/nursery/spliced_binned_pareto/tcn.py
imports: import torch
label_desc: Use image node_id 1 to create a new TCNBlock object from inherited base classes: torch.nn with example: obj = TCNBlock(in_channels, out_channels, kernel_size, dilation, bias, fwd_time, final)