class_docstr: RNN Model
  
  Args:
      input_size (int): input size (# features)
      hidden_size (int): hidden size
      num_layers (int): number of hidden layers
      rnn_arch (str): rnn architecture
      use_attn (bool): whether use attention layer.
          we use concat attention as https://github.com/fulifeng/Adv-ALSTM/
      dropout (float): dropout rate
class_docstr_tok: ["RNN","Model","Args",":","input_size","(","int",")",":","input","size","(","#","features",")","hidden_size","(","int",")",":","hidden","size","num_layers","(","int",")",":","number","of","hidden","layers","rnn_arch","(","str",")",":","rnn","architecture","use_attn","(","bool",")",":","whether","use","attention","layer",".","we","use","concat","attention","as","https",":","\/\/github.com\/fulifeng\/Adv-ALSTM\/","dropout","(","float",")",":","dropout","rate"]
code: def __init__(
      self,
      input_size=16,
      hidden_size=64,
      num_layers=2,
      rnn_arch="GRU",
      use_attn=True,
      dropout=0.0,
      **kwargs,
  ):
      super().__init__()
  
      self.input_size = input_size
      self.hidden_size = hidden_size
      self.num_layers = num_layers
      self.rnn_arch = rnn_arch
      self.use_attn = use_attn
  
      if hidden_size < input_size:
          # compression
          self.input_proj = nn.Linear(input_size, hidden_size)
      else:
          self.input_proj = None
  
      self.rnn = getattr(nn, rnn_arch)(
          input_size=min(input_size, hidden_size),
          hidden_size=hidden_size,
          num_layers=num_layers,
          batch_first=True,
          dropout=dropout,
      )
  
      if self.use_attn:
          self.W = nn.Linear(hidden_size, hidden_size)
          self.u = nn.Linear(hidden_size, 1, bias=False)
          self.output_size = hidden_size * 2
      else:
          self.output_size = hidden_size
  
imports: import io
  import os
  import copy
  import math
  import json
  import numpy
  import pandas
  import matplotlib.pyplot
  import torch
  import torch.nn
  import torch.optim
  import torch.nn.functional
  from tqdm import tqdm
  from qlib.constant import EPS
  from qlib.log import get_module_logger
  from qlib.model.base import Model
  from qlib.contrib.data.dataset import MTSDatasetH
label_desc: Use image node_id 1 to create a new RNN object from inherited base classes: nn with example: obj = RNN(input_size, hidden_size, num_layers, rnn_arch, use_attn, dropout)