code: def build_graph(num_actions):
      # Create shared deep q network
      s, q_network = build_dqn(
          num_actions=num_actions, action_repeat=action_repeat
      )
      network_params = tf.trainable_variables()
      q_values = q_network
  
      # Create shared target network
      st, target_q_network = build_dqn(
          num_actions=num_actions, action_repeat=action_repeat
      )
      target_network_params = tf.trainable_variables()[
          len(network_params) :
      ]
      target_q_values = target_q_network
  
      # Op for periodically updating target network with online network weights
      reset_target_network_params = [
          target_network_params[i].assign(network_params[i])
          for i in range(len(target_network_params))
      ]
  
      # Define cost and gradient update op
      a = tf.placeholder("float", [None, num_actions])
      y = tf.placeholder("float", [None])
      action_q_values = tf.reduce_sum(
          tf.multiply(q_values, a), reduction_indices=1
      )
      cost = tflearn.mean_square(action_q_values, y)
      optimizer = tf.train.RMSPropOptimizer(learning_rate)
      grad_update = optimizer.minimize(cost, var_list=network_params)
  
      graph_ops = {
          "s": s,
          "q_values": q_values,
          "st": st,
          "target_q_values": target_q_values,
          "reset_target_network_params": reset_target_network_params,
          "a": a,
          "y": y,
          "grad_update": grad_update,
      }
  
      return graph_ops
  
imports: from __future__ import division, print_function, absolute_import
  import threading
  import random
  import numpy
  import time
  from skimage.transform import resize
  from skimage.color import rgb2gray
  from collections import deque
  import gym
  import tensorflow.compat.v1
  import tflearn
label_desc: Use image node_id 4 for calling a global function with example usage: build_graph(num_actions) and returns: graph_ops