class_docstr: The network architecture proposed in `OPD <https://seqml.github.io/opd/opd_aaai21_supplement.pdf>`_.
  
  At every time step the input of policy network is divided into two parts,
  the public variables and the private variables. which are handled by ``raw_rnn``
  and ``pri_rnn`` in this network, respectively.
  
  One minor difference is that, in this implementation, we don't assume the direction to be fixed.
  Thus, another ``dire_fc`` is added to produce an extra direction-related feature.
class_docstr_tok: ["The","network","architecture","proposed","in","`","OPD","<","https",":","\/\/seqml.github.io\/opd\/opd_aaai21_supplement.pdf",">","`","_",".","At","every","time","step","the","input","of","policy","network","is","divided","into","two","parts",",","the","public","variables","and","the","private","variables",".","which","are","handled","by","``","raw_rnn","``","and","``","pri_rnn","``","in","this","network",",","respectively",".","One","minor","difference","is","that",",","in","this","implementation",",","we","do","n't","assume","the","direction","to","be","fixed",".","Thus",",","another","``","dire_fc","``","is","added","to","produce","an","extra","direction-related","feature","."]
code: def __init__(
      self,
      obs_space: FullHistoryObs,
      hidden_dim: int = 64,
      output_dim: int = 32,
      rnn_type: Literal["rnn", "lstm", "gru"] = "gru",
      rnn_num_layers: int = 1,
  ) -> None:
      super().__init__()
  
      self.hidden_dim = hidden_dim
      self.output_dim = output_dim
      self.num_sources = 3
  
      rnn_classes = {"rnn": nn.RNN, "lstm": nn.LSTM, "gru": nn.GRU}
  
      self.rnn_class = rnn_classes[rnn_type]
      self.rnn_layers = rnn_num_layers
  
      self.raw_rnn = self.rnn_class(
          hidden_dim,
          hidden_dim,
          batch_first=True,
          num_layers=self.rnn_layers,
      )
      self.prev_rnn = self.rnn_class(
          hidden_dim,
          hidden_dim,
          batch_first=True,
          num_layers=self.rnn_layers,
      )
      self.pri_rnn = self.rnn_class(
          hidden_dim,
          hidden_dim,
          batch_first=True,
          num_layers=self.rnn_layers,
      )
  
      self.raw_fc = nn.Sequential(
          nn.Linear(obs_space["data_processed"].shape[-1], hidden_dim),
          nn.ReLU(),
      )
      self.pri_fc = nn.Sequential(nn.Linear(2, hidden_dim), nn.ReLU())
      self.dire_fc = nn.Sequential(
          nn.Linear(2, hidden_dim),
          nn.ReLU(),
          nn.Linear(hidden_dim, hidden_dim),
          nn.ReLU(),
      )
  
      self._init_extra_branches()
  
      self.fc = nn.Sequential(
          nn.Linear(hidden_dim * self.num_sources, hidden_dim),
          nn.ReLU(),
          nn.Linear(hidden_dim, output_dim),
          nn.ReLU(),
      )
  
file_path: qlib/qlib/rl/order_execution/network.py
imports: from __future__ import annotations
  from typing import List, Tuple, cast
  import torch
  import torch.nn
  from tianshou.data import Batch
  from qlib.typehint import Literal
  from .interpreter import FullHistoryObs
label_desc: Use image node_id 1 to create a new Recurrent object from inherited base classes: nn with example: obj = Recurrent(obs_space, hidden_dim, output_dim, rnn_type, rnn_num_layers)