浏览代码

modified Environment to send a specific error when no external brains are in the environment

/develop-generalizationTraining-TrainerController
vincentpierre 7 年前
当前提交
5cae720d
共有 2 个文件被更改,包括 26 次插入7 次删除
  1. 31
      python/unityagents/environment.py
  2. 2
      unity-environment/Assets/ML-Agents/Scripts/Monitor.cs

31
python/unityagents/environment.py


value = {} if value is None else value
if self._loaded and not self._global_done and self._global_done is not None:
if isinstance(action, (int, np.int_, float, np.float_, list, np.ndarray)):
if self._num_external_brains > 1:
if self._num_external_brains == 1:
action = {self._external_brain_names[0]: action}
elif self._num_external_brains > 1:
action = {self._external_brain_names[0]: action}
raise UnityActionException(
"There are no external brains in the environment, "
"step cannot take an action input")
if self._num_external_brains > 1:
if self._num_external_brains == 1:
memory = {self._external_brain_names[0]: memory}
elif self._num_external_brains > 1:
memory = {self._external_brain_names[0]: memory}
raise UnityActionException(
"There are no external brains in the environment, "
"step cannot take a memory input")
if self._num_external_brains > 1:
if self._num_external_brains == 1:
value = {self._external_brain_names[0]: value}
elif self._num_external_brains > 1:
value = {self._external_brain_names[0]: value}
raise UnityActionException(
"There are no external brains in the environment, "
"step cannot take a value input")
for brain_name in action.keys() + memory.keys() + value.keys():
if brain_name not in self._external_brain_names:
raise UnityActionException(
"The name {0} does not correspond to an external brain "
"in the environment". format(brain_name))
for b in self._external_brain_names:
n_agent = len(self._data[b].agents)

2
unity-environment/Assets/ML-Agents/Scripts/Monitor.cs


}
if (valsSum == 0)
{
Debug.LogError(string.Format("The value for key {0} must be "
Debug.LogError(string.Format("The Monitor value for key {0} must be "
+ "a list or array of positive values and cannot be empty.", key));
}
else

正在加载...
取消
保存