docstr: Build a basic CNN encoder
  
  Parameters
  ----------
  input_dim : int
      The input dimension
  output_dim : int
      The output dimension
  kernel_size : int
      The size of convolutional kernels
docstr_tok: ["Build","a","basic","CNN","encoder","Parameters","--","--","--","--","--","input_dim",":","int","The","input","dimension","output_dim",":","int","The","output","dimension","kernel_size",":","int","The","size","of","convolutional","kernels"]
code: def __init__(self, input_dim, output_dim, kernel_size, device):
      """Build a basic CNN encoder
  
      Parameters
      ----------
      input_dim : int
          The input dimension
      output_dim : int
          The output dimension
      kernel_size : int
          The size of convolutional kernels
      """
      super().__init__()
  
      self.input_dim = input_dim
      self.output_dim = output_dim
      self.kernel_size = kernel_size
      self.device = device
  
      # set padding to ensure the same length
      # it is correct only when kernel_size is odd, dilation is 1, stride is 1
      self.conv = nn.Conv1d(
          input_dim,
          output_dim,
          kernel_size,
          padding=(kernel_size - 1) // 2,
      )
  
imports: from __future__ import division
  from __future__ import print_function
  import numpy
  import pandas
  from typing import Text, Union
  import copy
  from ...utils import get_or_create_path
  from ...log import get_module_logger
  import torch
  import torch.nn
  import torch.optim
  from ...model.base import Model
  from ...data.dataset import DatasetH
  from ...data.dataset.handler import DataHandlerLP
label_desc: Use image node_id 1 to create a new CNNEncoderBase object from inherited base classes: nn with example: obj = CNNEncoderBase(input_dim, output_dim, kernel_size, device)