class_docstr: A DQN model for 2D/3D (image) observations.
class_docstr_tok: ["A","DQN","model","for","2D\/3D","(","image",")","observations","."]
code: def _get_DQN_prediction(self, image):
      assert image.shape.rank in [4, 5], image.shape
      # image: N, H, W, (C), Hist
      if image.shape.rank == 5:
          # merge C & Hist
          image = tf.reshape(
              image,
              [-1]
              + list(self.state_shape[:2])
              + [self.state_shape[2] * FRAME_HISTORY],
          )
  
      image = image / 255.0
      with argscope(
          Conv2D, activation=lambda x: PReLU("prelu", x), use_bias=True
      ):
          l = (
              LinearWrap(image)
              # Nature architecture
              .Conv2D("conv0", 32, 8, strides=4)
              .Conv2D("conv1", 64, 4, strides=2)
              .Conv2D("conv2", 64, 3)
              # architecture used for the figure in the README, slower but takes fewer iterations to converge
              # .Conv2D('conv0', out_channel=32, kernel_shape=5)
              # .MaxPooling('pool0', 2)
              # .Conv2D('conv1', out_channel=32, kernel_shape=5)
              # .MaxPooling('pool1', 2)
              # .Conv2D('conv2', out_channel=64, kernel_shape=4)
              # .MaxPooling('pool2', 2)
              # .Conv2D('conv3', out_channel=64, kernel_shape=3)
              .FullyConnected("fc0", 512)
              .tf.nn.leaky_relu(alpha=0.01)()
          )
      if self.method != "Dueling":
          Q = FullyConnected("fct", l, self.num_actions)
      else:
          # Dueling DQN
          V = FullyConnected("fctV", l, 1)
          As = FullyConnected("fctA", l, self.num_actions)
          Q = tf.add(As, V - tf.reduce_mean(As, 1, keep_dims=True))
      return tf.identity(Q, name="Qvalue")
  
file_path: tensorpack/examples/DeepQNetwork/DQN.py
imports: import argparse
  import numpy
  import os
  import cv2
  import gym
  import tensorflow
  from tensorpack import *
  from atari_wrapper import FireResetEnv, FrameStack, LimitLength, MapState
  from common import Evaluator, eval_model_multithread, play_n_episodes
  from DQNModel import Model
  from expreplay import ExpReplay
label_desc: Use image node_id 1 for calling the Model obj's underlying member method code with example usage: obj._get_DQN_prediction(image) and returns: tf