docstr: Launch forward prediction for the new state given by some client.
docstr_tok: ["Launch","forward","prediction","for","the","new","state","given","by","some","client","."]
code: def _on_state(self, state, client):
      """
      Launch forward prediction for the new state given by some client.
      """
  
      def cb(outputs):
          try:
              distrib, value = outputs.result()
          except CancelledError:
              logger.info(
                  "Client {} cancelled.".format(
                      client.ident.decode("utf-8")
                  )
              )
              return
          assert np.all(np.isfinite(distrib)), distrib
          action = np.random.choice(len(distrib), p=distrib)
          client.memory.append(
              TransitionExperience(
                  state,
                  action,
                  reward=None,
                  value=value,
                  prob=distrib[action],
              )
          )
          self.send_queue.put([client.ident, dumps(action)])
  
      self.async_predictor.put_task([state], cb)
  
imports: import argparse
  import cv2
  import gym
  import multiprocessing
  import numpy
  import os
  import sys
  import uuid
  import tensorflow
  from six.moves import queue
  from concurrent import futures
  from tensorpack import *
  from tensorpack.tfutils.gradproc import MapGradient, SummaryGradient
  from tensorpack.utils.concurrency import ensure_proc_terminate, start_proc_mask_signal
  from tensorpack.utils.gpu import get_num_gpu
  from tensorpack.utils.serialize import dumps
  from atari_wrapper import FireResetEnv, FrameStack, LimitLength, MapState
  from common import Evaluator, eval_model_multithread, play_n_episodes
  from simulator import SimulatorMaster, SimulatorProcess, TransitionExperience
label_desc: Use image node_id 4 for calling the MySimulatorMaster obj's underlying member method code with example usage: obj._on_state(state, client) without return types