code: def reward_per_episode_test(
      env_fn, learn_fn, min_avg_reward, n_trials=N_EPISODES
  ):
      env = DummyVecEnv([env_fn])
      with tf.Graph().as_default(), tf.Session(
          config=_sess_config
      ).as_default():
          model = learn_fn(env)
          N_TRIALS = 100
          observations, actions, rewards = rollout(env, model, N_TRIALS)
          rewards = [sum(r) for r in rewards]
          avg_rew = sum(rewards) / N_TRIALS
          print(
              "Average reward in {} episodes is {}".format(
                  n_trials, avg_rew
              )
          )
          assert (
              avg_rew > min_avg_reward
          ), "average reward in {} episodes ({}) is less than {}".format(
              n_trials, avg_rew, min_avg_reward
          )
  
imports: import tensorflow
  import numpy
  from baselines.common.vec_env.dummy_vec_env import DummyVecEnv
label_desc: Use image node_id 2 for calling a global function with example usage: reward_per_episode_test(env_fn, learn_fn, min_avg_reward, n_trials) without return types