class_docstr: PPOTuner, the implementation inherits the main logic of the implementation
  `ppo2 from openai <https://github.com/openai/baselines/tree/master/baselines/ppo2>`__ and is adapted for NAS scenario.
  It uses ``lstm`` for its policy network and value network, policy and value share the same network.
  
  Parameters
  ----------
  optimize_mode : str
      maximize or minimize
  trials_per_update : int
      Number of trials to have for each model update
  epochs_per_update : int
      Number of epochs to run for each model update
  minibatch_size : int
      Minibatch size (number of trials) for the update
  ent_coef : float
      Policy entropy coefficient in the optimization objective
  lr : float
      Learning rate of the model (lstm network), constant
  vf_coef : float
      Value function loss coefficient in the optimization objective
  max_grad_norm : float
      Gradient norm clipping coefficient
  gamma : float
      Discounting factor
  lam : float
      Advantage estimation discounting factor (lambda in the paper)
  cliprange : float
      Cliprange in the PPO algorithm, constant
class_docstr_tok: ["PPOTuner",",","the","implementation","inherits","the","main","logic","of","the","implementation","`","ppo2","from","openai","<","https",":","\/\/github.com\/openai\/baselines\/tree\/master\/baselines\/ppo2",">","`","__","and","is","adapted","for","NAS","scenario",".","It","uses","``","lstm","``","for","its","policy","network","and","value","network",",","policy","and","value","share","the","same","network",".","Parameters","--","--","--","--","--","optimize_mode",":","str","maximize","or","minimize","trials_per_update",":","int","Number","of","trials","to","have","for","each","model","update","epochs_per_update",":","int","Number","of","epochs","to","run","for","each","model","update","minibatch_size",":","int","Minibatch","size","(","number","of","trials",")","for","the","update","ent_coef",":","float","Policy","entropy","coefficient","in","the","optimization","objective","lr",":","float","Learning","rate","of","the","model","(","lstm","network",")",",","constant","vf_coef",":","float","Value","function","loss","coefficient","in","the","optimization","objective","max_grad_norm",":","float","Gradient","norm","clipping","coefficient","gamma",":","float","Discounting","factor","lam",":","float","Advantage","estimation","discounting","factor","(","lambda","in","the","paper",")","cliprange",":","float","Cliprange","in","the","PPO","algorithm",",","constant"]
docstr: Different step could have different action space. to deal with this case, we merge all the
  possible actions into one action space, and use mask to indicate available actions for each step
docstr_tok: ["Different","step","could","have","different","action","space",".","to","deal","with","this","case",",","we","merge","all","the","possible","actions","into","one","action","space",",","and","use","mask","to","indicate","available","actions","for","each","step"]
code: def _generate_action_mask(self):
      """
      Different step could have different action space. to deal with this case, we merge all the
      possible actions into one action space, and use mask to indicate available actions for each step
      """
      two_masks = []
  
      mask = []
      for acts in self.actions_spaces:
          one_mask = [0 for _ in range(len(self.full_act_space))]
          for act in acts:
              idx = self.full_act_space.index(act)
              one_mask[idx] = 1
          mask.append(one_mask)
      two_masks.append(mask)
  
      mask = []
      for acts in self.actions_spaces:
          one_mask = [-np.inf for _ in range(len(self.full_act_space))]
          for act in acts:
              idx = self.full_act_space.index(act)
              one_mask[idx] = 0
          mask.append(one_mask)
      two_masks.append(mask)
  
      return np.asarray(two_masks, dtype=np.float32)
  
imports: import copy
  import logging
  import numpy
  from gym import spaces
  from schema import Schema, Optional
  import nni
  from nni import ClassArgsValidator
  from nni.tuner import Tuner
  from nni.utils import OptimizeMode, extract_scalar_reward
  from .model import Model
  from .util import set_global_seeds
  from .policy import build_lstm_policy
label_desc: Use image node_id 3 for calling the PPOTuner obj's underlying member method code with example usage: obj._generate_action_mask() and returns: np