class_docstr: Soft Actor-Critic (SAC)
  Off-Policy Maximum Entropy Deep Reinforcement Learning with a Stochastic Actor,
  This implementation borrows code from original implementation (https://github.com/haarnoja/sac)
  from OpenAI Spinning Up (https://github.com/openai/spinningup) and from the Softlearning repo
  (https://github.com/rail-berkeley/softlearning/)
  Paper: https://arxiv.org/abs/1801.01290
  Introduction to SAC: https://spinningup.openai.com/en/latest/algorithms/sac.html
  
  :param policy: (SACPolicy or str) The policy model to use (MlpPolicy, CnnPolicy, LnMlpPolicy, ...)
  :param env: (Gym environment or str) The environment to learn from (if registered in Gym, can be str)
  :param gamma: (float) the discount factor
  :param learning_rate: (float or callable) learning rate for adam optimizer,
      the same learning rate will be used for all networks (Q-Values, Actor and Value function)
      it can be a function of the current progress (from 1 to 0)
  :param buffer_size: (int) size of the replay buffer
  :param batch_size: (int) Minibatch size for each gradient update
  :param tau: (float) the soft update coefficient ("polyak update", between 0 and 1)
  :param ent_coef: (str or float) Entropy regularization coefficient. (Equivalent to
      inverse of reward scale in the original SAC paper.)  Controlling exploration/exploitation trade-off.
      Set it to 'auto' to learn it automatically (and 'auto_0.1' for using 0.1 as initial value)
  :param train_freq: (int) Update the model every `train_freq` steps.
  :param learning_starts: (int) how many steps of the model to collect transitions for before learning starts
  :param target_update_interval: (int) update the target network every `target_network_update_freq` steps.
  :param gradient_steps: (int) How many gradient update after each step
  :param target_entropy: (str or float) target entropy when learning ent_coef (ent_coef = 'auto')
  :param action_noise: (ActionNoise) the action noise type (None by default), this can help
      for hard exploration problem. Cf DDPG for the different action noise type.
  :param random_exploration: (float) Probability of taking a random action (as in an epsilon-greedy strategy)
      This is not needed for SAC normally but can help exploring when using HER + SAC.
      This hack was present in the original OpenAI Baselines repo (DDPG + HER)
  :param verbose: (int) the verbosity level: 0 none, 1 training information, 2 tensorflow debug
  :param tensorboard_log: (str) the log location for tensorboard (if None, no logging)
  :param _init_setup_model: (bool) Whether or not to build the network at the creation of the instance
  :param policy_kwargs: (dict) additional arguments to be passed to the policy on creation
  :param full_tensorboard_log: (bool) enable additional logging when using tensorboard
      Note: this has no effect on SAC logging for now
  :param seed: (int) Seed for the pseudo-random generators (python, numpy, tensorflow).
      If None (default), use random seed. Note that if you want completely deterministic
      results, you must set `n_cpu_tf_sess` to 1.
  :param n_cpu_tf_sess: (int) The number of threads for TensorFlow operations
      If None, the number of cpu of the current machine will be used.
class_docstr_tok: ["Soft","Actor-Critic","(","SAC",")","Off-Policy","Maximum","Entropy","Deep","Reinforcement","Learning","with","a","Stochastic","Actor",",","This","implementation","borrows","code","from","original","implementation","(","https",":","\/\/github.com\/haarnoja\/sac",")","from","OpenAI","Spinning","Up","(","https",":","\/\/github.com\/openai\/spinningup",")","and","from","the","Softlearning","repo","(","https",":","\/\/github.com\/rail-berkeley\/softlearning\/",")","Paper",":","https",":","\/\/arxiv.org\/abs\/1801.01290","Introduction","to","SAC",":","https",":","\/\/spinningup.openai.com\/en\/latest\/algorithms\/sac.html",":","param","policy",":","(","SACPolicy","or","str",")","The","policy","model","to","use","(","MlpPolicy",",","CnnPolicy",",","LnMlpPolicy",",","...",")",":","param","env",":","(","Gym","environment","or","str",")","The","environment","to","learn","from","(","if","registered","in","Gym",",","can","be","str",")",":","param","gamma",":","(","float",")","the","discount","factor",":","param","learning_rate",":","(","float","or","callable",")","learning","rate","for","adam","optimizer",",","the","same","learning","rate","will","be","used","for","all","networks","(","Q-Values",",","Actor","and","Value","function",")","it","can","be","a","function","of","the","current","progress","(","from","1","to","0",")",":","param","buffer_size",":","(","int",")","size","of","the","replay","buffer",":","param","batch_size",":","(","int",")","Minibatch","size","for","each","gradient","update",":","param","tau",":","(","float",")","the","soft","update","coefficient","(","``","polyak","update","''",",","between","0","and","1",")",":","param","ent_coef",":","(","str","or","float",")","Entropy","regularization","coefficient",".","(","Equivalent","to","inverse","of","reward","scale","in","the","original","SAC","paper",".",")","Controlling","exploration\/exploitation","trade-off",".","Set","it","to","'auto","'","to","learn","it","automatically","(","and","'auto_0.1","'","for","using","0.1","as","initial","value",")",":","param","train_freq",":","(","int",")","Update","the","model","every","`","train_freq","`","steps",".",":","param","learning_starts",":","(","int",")","how","many","steps","of","the","model","to","collect","transitions","for","before","learning","starts",":","param","target_update_interval",":","(","int",")","update","the","target","network","every","`","target_network_update_freq","`","steps",".",":","param","gradient_steps",":","(","int",")","How","many","gradient","update","after","each","step",":","param","target_entropy",":","(","str","or","float",")","target","entropy","when","learning","ent_coef","(","ent_coef","=","'auto","'",")",":","param","action_noise",":","(","ActionNoise",")","the","action","noise","type","(","None","by","default",")",",","this","can","help","for","hard","exploration","problem",".","Cf","DDPG","for","the","different","action","noise","type",".",":","param","random_exploration",":","(","float",")","Probability","of","taking","a","random","action","(","as","in","an","epsilon-greedy","strategy",")","This","is","not","needed","for","SAC","normally","but","can","help","exploring","when","using","HER","+","SAC",".","This","hack","was","present","in","the","original","OpenAI","Baselines","repo","(","DDPG","+","HER",")",":","param","verbose",":","(","int",")","the","verbosity","level",":","0","none",",","1","training","information",",","2","tensorflow","debug",":","param","tensorboard_log",":","(","str",")","the","log","location","for","tensorboard","(","if","None",",","no","logging",")",":","param","_init_setup_model",":","(","bool",")","Whether","or","not","to","build","the","network","at","the","creation","of","the","instance",":","param","policy_kwargs",":","(","dict",")","additional","arguments","to","be","passed","to","the","policy","on","creation",":","param","full_tensorboard_log",":","(","bool",")","enable","additional","logging","when","using","tensorboard","Note",":","this","has","no","effect","on","SAC","logging","for","now",":","param","seed",":","(","int",")","Seed","for","the","pseudo-random","generators","(","python",",","numpy",",","tensorflow",")",".","If","None","(","default",")",",","use","random","seed",".","Note","that","if","you","want","completely","deterministic","results",",","you","must","set","`","n_cpu_tf_sess","`","to","1.",":","param","n_cpu_tf_sess",":","(","int",")","The","number","of","threads","for","TensorFlow","operations","If","None",",","the","number","of","cpu","of","the","current","machine","will","be","used","."]
code: def predict(
      self, observation, state=None, mask=None, deterministic=True
  ):
      observation = np.array(observation)
      vectorized_env = self._is_vectorized_observation(
          observation, self.observation_space
      )
  
      observation = observation.reshape(
          (-1,) + self.observation_space.shape
      )
      actions = self.policy_tf.step(
          observation, deterministic=deterministic
      )
      actions = actions.reshape(
          (-1,) + self.action_space.shape
      )  # reshape to the correct action shape
      actions = unscale_action(
          self.action_space, actions
      )  # scale the output for the prediction
  
      if not vectorized_env:
          actions = actions[0]
  
      return actions, None
  
imports: import time
  import warnings
  import numpy
  import tensorflow
  from stable_baselines.common import tf_util, OffPolicyRLModel, SetVerbosity, TensorboardWriter
  from stable_baselines.common.vec_env import VecEnv
  from stable_baselines.common.math_util import safe_mean, unscale_action, scale_action
  from stable_baselines.common.schedules import get_schedule_fn
  from stable_baselines.common.buffers import ReplayBuffer
  from stable_baselines.sac.policies import SACPolicy
  from stable_baselines import logger
label_desc: Use image node_id 7 for calling the SAC obj's underlying member method code with example usage: obj.predict(observation, state, mask, deterministic) and returns: actions,  None