class_docstr: This function implements 1d pooling of the input tensor.
  
  Arguments
  ---------
  pool_type : str
      It is the type of pooling function to use ('avg','max').
  kernel_size : int
      It is the kernel size that defines the pooling dimension.
      For instance, kernel size=3 applies a 1D Pooling with a size=3.
  input_dims : int
      The count of dimensions expected in the input.
  pool_axis : int
      The axis where the pooling is applied.
  stride : int
      It is the stride size.
  padding : int
      It is the number of padding elements to apply.
  dilation : int
      Controls the dilation factor of pooling.
  ceil_mode : bool
      When True, will use ceil instead of floor to compute the output shape.
  
  Example
  -------
  >>> pool = Pooling1d('max',3)
  >>> inputs = torch.rand(10, 12, 40)
  >>> output=pool(inputs)
  >>> output.shape
  torch.Size([10, 4, 40])
code: def __init__(
      self,
      pool_type,
      kernel_size,
      input_dims=3,
      pool_axis=1,
      ceil_mode=False,
      padding=0,
      dilation=1,
      stride=None,
  ):
      super().__init__()
      self.pool_axis = pool_axis
  
      if stride is None:
          stride = kernel_size
  
      if pool_type == "avg":
          if input_dims == 3:
              self.pool_layer = torch.nn.AvgPool1d(
                  kernel_size,
                  stride=stride,
                  padding=padding,
                  ceil_mode=ceil_mode,
              )
          elif input_dims == 4:
              self.pool_layer = torch.nn.AvgPool2d(
                  (1, kernel_size),
                  stride=(1, stride),
                  padding=(0, padding),
                  ceil_mode=ceil_mode,
              )
          else:
              raise ValueError("input_dims must be 3 or 4")
  
      elif pool_type == "max":
          if input_dims == 3:
              self.pool_layer = torch.nn.MaxPool1d(
                  kernel_size,
                  stride=stride,
                  padding=padding,
                  dilation=dilation,
                  ceil_mode=ceil_mode,
              )
          elif input_dims == 4:
              self.pool_layer = torch.nn.MaxPool2d(
                  (1, kernel_size),
                  stride=(1, stride),
                  padding=(0, padding),
                  dilation=(1, dilation),
                  ceil_mode=ceil_mode,
              )
          else:
              raise ValueError("input_dims must be 3 or 4")
  
      else:
          raise ValueError("pool_type must be 'avg' or 'max'")
  
imports: import torch
  import logging
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 1 to create a new Pooling1d object from inherited base classes: nn with example: obj = Pooling1d(pool_type, kernel_size, input_dims, pool_axis, ceil_mode, padding, dilation, stride)