code: def __init__(self, algorithm, obs_dim, act_dim, ensemble_num):
      self.obs_dim = obs_dim
      self.act_dim = act_dim
      self.ensemble_num = ensemble_num
      super(OpenSimAgent, self).__init__(algorithm)
  
      # Use ParallelExecutor to make program running faster
      use_cuda = True if parl.GPU_ID >= 0 else False
      self.learn_pe = []
      self.pred_pe = []
  
      exec_strategy = fluid.ExecutionStrategy()
      exec_strategy.use_experimental_executor = True
      exec_strategy.num_threads = 4
      build_strategy = fluid.BuildStrategy()
      build_strategy.remove_unnecessary_lock = True
  
      for i in range(self.ensemble_num):
          with fluid.scope_guard(fluid.global_scope().new_scope()):
              pe = fluid.ParallelExecutor(
                  use_cuda=use_cuda,
                  main_program=self.learn_programs[i],
                  exec_strategy=exec_strategy,
                  build_strategy=build_strategy,
              )
              self.learn_pe.append(pe)
  
          with fluid.scope_guard(fluid.global_scope().new_scope()):
              pe = fluid.ParallelExecutor(
                  use_cuda=use_cuda,
                  main_program=self.predict_programs[i],
                  exec_strategy=exec_strategy,
                  build_strategy=build_strategy,
              )
              self.pred_pe.append(pe)
  
          # Attention: In the beginning, sync target model totally.
          self.alg.sync_target(
              model_id=i,
              decay=0,
              share_vars_parallel_executor=self.learn_pe[i],
          )
          # Do cache, will create ParallelExecutor of sync params in advance
          # If not, there are some issues when ensemble_num > 1
          self.alg.sync_target(
              model_id=i, share_vars_parallel_executor=self.learn_pe[i]
          )
  
      with fluid.scope_guard(fluid.global_scope().new_scope()):
          self.ensemble_predict_pe = fluid.ParallelExecutor(
              use_cuda=use_cuda,
              main_program=self.ensemble_predict_program,
              exec_strategy=exec_strategy,
              build_strategy=build_strategy,
          )
  
file_path: PARL/examples/NeurIPS2018-AI-for-Prosthetics-Challenge/opensim_agent.py
imports: import numpy
  import re
  import parl
  from parl import layers
  from paddle import fluid
  from paddle.fluid.executor import _fetch_var
  from parl.utils import logger
label_desc: Use image node_id 1 to create a new OpenSimAgent object from inherited base classes: parl with example: obj = OpenSimAgent(algorithm, obs_dim, act_dim, ensemble_num)