简体   繁体   English

具有具有输入参数的环境的 Tf 代理并行 Py 环境

[英]Tf Agents Parallel Py Environment With an Environment that has Input Parameters

Suppose you have an environment that has input parameters: for example, to create an instance you would use假设您有一个具有输入参数的环境:例如,要创建一个您将使用的实例

env_instance = MyEnv(var_1=3, var_2=5, ...)

Now suppose you want to create a parallel_py_environment using the environment "MyEnv"?现在假设您想使用环境“MyEnv”创建一个 parallel_py_environment ? Since you need input parameters, you cannot use由于您需要输入参数,因此不能使用

tf_py_environment.TFPyEnvironment(parallel_py_environment.ParallelPyEnvironment([MyEnv]*int(n_envs)))

The solution is to create a super class:解决方法是创建一个超类:

class MyEnvPar(MyEnv):
    def __init__(self):
        super().__init__(var_1=3, var_2=5)

And then you can use然后你可以使用

tf_py_environment.TFPyEnvironment(parallel_py_environment.ParallelPyEnvironment([MyEnvPar]*int(n_envs)))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 运行 Tensorflow model model_main_tf2.py 有 SyntaxError - Running Tensorflow model model_main_tf2.py has SyntaxError 使用 PyEnvironment TF-Agents 包装自定义健身房 - Wrapping custom gym with PyEnvironment TF-Agents TF 2.0 GPU配置,如何在pycharm中创建另一个虚拟环境后配置tensorflow-gpu 2.0和cuda,cudnn - TF 2.0 GPU cofingure, how to configure the tensorflow-gpu 2.0 and cuda, cudnn after create another virtual environment in pycharm Tensorflow 2.x 代理(TF-代理,强化学习模块)和 PySC2 - Tensorflow 2.x Agents(TF-Agents, Reinforcement Learning Module) & PySC2 如何获得 tf-agents 中所有动作的概率向量? - How to get probability vector for all actions in tf-agents? tf数据window多输入 - tf data window multi input TF-Agents TypeError: 两个结构不匹配,next_step_type, policy_info - TF-Agents TypeError: The two structures do not match, next_step_type, policy_info 'Tensor' 对象在 TF 2.0 的 tf.function 中没有属性 'numpy' - 'Tensor' object has no attribute 'numpy' in tf.function in TF 2.0 自定义层需要将 tf.keras.input 空张量更改为 numpy ndarray - 'Tensor' object has no attribute 'numpy' 错误 - Custom layer needs changing tf.keras.input empty tensor into numpy ndarray - 'Tensor' object has no attribute 'numpy' error Pycharm 环境文件消失了 - Pycharm environment files have disappeared
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM