浏览代码

adding doc comments, making Dimension Properties static

/bullet-hell-barracuda-test-1.3.1
vincentpierre 4 年前
当前提交
ffef4b30
共有 3 个文件被更改,包括 31 次插入6 次删除
  1. 19
      com.unity.ml-agents/Runtime/Sensors/BufferSensor.cs
  2. 12
      com.unity.ml-agents/Runtime/Sensors/BufferSensorComponent.cs
  3. 6
      com.unity.ml-agents/Runtime/Sensors/CameraSensor.cs

19
com.unity.ml-agents/Runtime/Sensors/BufferSensor.cs


namespace Unity.MLAgents.Sensors
{
/// <summary>
/// A Sensor that allows to observe a variable number of entities.
/// </summary>
public class BufferSensor : ISensor, IDimensionPropertiesSensor, IBuiltInSensor
{
private int m_MaxNumObs;

static DimensionProperty[] m_DimensionProperties = new DimensionProperty[]{
DimensionProperty.VariableSize,
DimensionProperty.None
};
public BufferSensor(int maxNumberObs, int obsSize)
{
m_MaxNumObs = maxNumberObs;

/// <inheritdoc/>
public DimensionProperty[] GetDimensionProperties()
{
return new DimensionProperty[]{
DimensionProperty.VariableSize,
DimensionProperty.None
};
return m_DimensionProperties;
}
/// <summary>

/// <param name="obs"> The float array observation</param>
public void AppendObservation(float[] obs)
{
if (obs.Length != m_ObsSize)
{
throw new UnityAgentsException(
"The BufferSensor was expecting an observation of size " +
$"{m_ObsSize} but received {obs.Length} observations instead."
)
}
if (m_CurrentNumObservables >= m_MaxNumObs)
{
return;

12
com.unity.ml-agents/Runtime/Sensors/BufferSensorComponent.cs


{
/// <summary>
/// A component for BufferSensor.
/// A SensorComponent that creates a <see cref="BufferSensor"/>.
/// <summary>
/// This is how many floats each entities will be represented with. This number
/// is fixed and all entities must have the same representation.
/// </summary>
/// <summary>
/// This is the maximum number of entities the `BufferSensor` will be able to
/// collect.
/// </summary>
private BufferSensor m_Sensor;
/// <inheritdoc/>

6
com.unity.ml-agents/Runtime/Sensors/CameraSensor.cs


string m_Name;
int[] m_Shape;
SensorCompressionType m_CompressionType;
static DimensionProperty[] m_DimensionProperties = new DimensionProperty[] {
DimensionProperty.TranslationalEquivariance,
DimensionProperty.TranslationalEquivariance,
DimensionProperty.None };
/// <summary>
/// The Camera used for rendering the sensor observations.

/// <returns></returns>
public DimensionProperty[] GetDimensionProperties()
{
return new DimensionProperty[] { DimensionProperty.TranslationalEquivariance, DimensionProperty.TranslationalEquivariance, DimensionProperty.None };
return m_DimensionProperties;
}
/// <summary>

正在加载...
取消
保存