浏览代码

fix imports in test utils

/develop/actionmodel-csharp
Andrew Cohen 4 年前
当前提交
6ffbf209
共有 3 个文件被更改,包括 6 次插入7 次删除
  1. 4
      ml-agents-envs/mlagents_envs/base_env.py
  2. 5
      ml-agents/mlagents/trainers/subprocess_env_manager.py
  3. 4
      ml-agents/mlagents/trainers/tests/torch/test_utils.py

4
ml-agents-envs/mlagents_envs/base_env.py


for the correct number of agents and ensures the type.
"""
_expected_shape = (n_agents, self.continuous_size)
if self.continuous_size > 0 and actions.continuous.shape != _expected_shape:
if actions.continuous.shape != _expected_shape:
raise UnityActionException(
f"The behavior {name} needs a continuous input of dimension "
f"{_expected_shape} for (<number of agents>, <action size>) but "

if self.discrete_size > 0 and actions.discrete.shape != _expected_shape:
if actions.discrete.shape != _expected_shape:
raise UnityActionException(
f"The behavior {name} needs a discrete input of dimension "
f"{_expected_shape} for (<number of agents>, <action size>) but "

5
ml-agents/mlagents/trainers/subprocess_env_manager.py


if req.cmd == EnvironmentCommand.STEP:
all_action_info = req.payload
for brain_name, action_info in all_action_info.items():
if len(action_info.action) != 0:
if (
len(action_info.action.continuous) > 0
or len(action_info.action.discrete) > 0
):
env.set_actions(brain_name, action_info.action)
env.step()
all_step_result = _generate_all_results()

4
ml-agents/mlagents/trainers/tests/torch/test_utils.py


from mlagents.trainers.torch.utils import ModelUtils
from mlagents.trainers.exception import UnityTrainerException
from mlagents.trainers.torch.encoders import VectorInput
from mlagents.trainers.torch.distributions import (
CategoricalDistInstance,
GaussianDistInstance,
)
def test_min_visual_size():

正在加载...
取消
保存