docstr: Build an encoder composed of CNN and KRNN
  
  Parameters
  ----------
  cnn_input_dim : int
      The input dimension of CNN
  cnn_output_dim : int
      The output dimension of CNN
  cnn_kernel_size : int
      The size of convolutional kernels
  rnn_output_dim : int
      The output dimension of KRNN
  rnn_dup_num : int
      The number of parallel duplicates for KRNN
  rnn_layers : int
      The number of RNN layers
docstr_tok: ["Build","an","encoder","composed","of","CNN","and","KRNN","Parameters","--","--","--","--","--","cnn_input_dim",":","int","The","input","dimension","of","CNN","cnn_output_dim",":","int","The","output","dimension","of","CNN","cnn_kernel_size",":","int","The","size","of","convolutional","kernels","rnn_output_dim",":","int","The","output","dimension","of","KRNN","rnn_dup_num",":","int","The","number","of","parallel","duplicates","for","KRNN","rnn_layers",":","int","The","number","of","RNN","layers"]
code: def __init__(
      self,
      cnn_input_dim,
      cnn_output_dim,
      cnn_kernel_size,
      rnn_output_dim,
      rnn_dup_num,
      rnn_layers,
      dropout,
      device,
  ):
      """Build an encoder composed of CNN and KRNN
  
      Parameters
      ----------
      cnn_input_dim : int
          The input dimension of CNN
      cnn_output_dim : int
          The output dimension of CNN
      cnn_kernel_size : int
          The size of convolutional kernels
      rnn_output_dim : int
          The output dimension of KRNN
      rnn_dup_num : int
          The number of parallel duplicates for KRNN
      rnn_layers : int
          The number of RNN layers
      """
      super().__init__()
  
      self.cnn_encoder = CNNEncoderBase(
          cnn_input_dim, cnn_output_dim, cnn_kernel_size, device
      )
      self.krnn_encoder = KRNNEncoderBase(
          cnn_output_dim,
          rnn_output_dim,
          rnn_dup_num,
          rnn_layers,
          dropout,
          device,
      )
  
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 CNNKRNNEncoder object from inherited base classes: nn with example: obj = CNNKRNNEncoder(cnn_input_dim, cnn_output_dim, cnn_kernel_size, rnn_output_dim, rnn_dup_num, rnn_layers, dropout, device)