浏览代码

Added a numberOfActions get property on the BrainParameters (#3571)

* Added a numberOfActions get property on the BrainParameters

* forgot one place to replace

* [skip ci] numberOfActions --> numActions
/bug-failed-api-check
GitHub 5 年前
当前提交
91bbcabb
共有 2 个文件被更改,包括 17 次插入14 次删除
  1. 17
      com.unity.ml-agents/Runtime/Agent.cs
  2. 14
      com.unity.ml-agents/Runtime/Policies/BrainParameters.cs

17
com.unity.ml-agents/Runtime/Agent.cs


// should stay the previous action before the Done(), so that it is properly recorded.
if (m_Action.vectorActions == null)
{
if (param.vectorActionSpaceType == SpaceType.Continuous)
{
m_Action.vectorActions = new float[param.vectorActionSize[0]];
m_Info.storedVectorActions = new float[param.vectorActionSize[0]];
}
else
{
m_Action.vectorActions = new float[param.vectorActionSize.Length];
m_Info.storedVectorActions = new float[param.vectorActionSize.Length];
}
m_Action.vectorActions = new float[param.numActions];
m_Info.storedVectorActions = new float[param.numActions];
}
}

{
Debug.LogWarning("Heuristic method called but not implemented. Returning placeholder actions.");
var param = m_PolicyFactory.brainParameters;
var actionSize = param.vectorActionSpaceType == SpaceType.Continuous ?
param.vectorActionSize[0] :
param.vectorActionSize.Length;
return new float[actionSize];
return new float[param.numActions];
}
/// <summary>

14
com.unity.ml-agents/Runtime/Policies/BrainParameters.cs


/// </summary>
public SpaceType vectorActionSpaceType = SpaceType.Discrete;
public int numActions
{
get{
switch(vectorActionSpaceType){
case SpaceType.Discrete:
return vectorActionSize.Length;
case SpaceType.Continuous:
return vectorActionSize[0];
default:
return 0;
}
}
}
/// <summary>
/// Deep clones the BrainParameter object.
/// </summary>

正在加载...
取消
保存