浏览代码

use [1,0,0..] for empty

/grid-onehot-extra-dim-empty
Ruo-Ping Dong 3 年前
当前提交
9a791396
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 3
      com.unity.ml-agents/Runtime/Sensors/GridSensorBase.cs
  2. 5
      com.unity.ml-agents/Runtime/Sensors/OneHotGridSensor.cs

3
com.unity.ml-agents/Runtime/Sensors/GridSensorBase.cs


Color[] m_PerceptionColors;
Texture2D m_PerceptionTexture;
float[] m_CellDataBuffer;
protected float[] m_DefaultObservation;
// Utility Constants Calculated on Init
int m_NumCells;

{
Array.Clear(m_PerceptionBuffer, 0, m_PerceptionBuffer.Length);
Array.Clear(m_CellDataBuffer, 0, m_CellDataBuffer.Length);
Array.Copy(m_DefaultObservation, m_CellDataBuffer, m_DefaultObservation.Length);
}
else
{

m_DefaultObservation = new float[m_CellObservationSize];
}
}

5
com.unity.ml-agents/Runtime/Sensors/OneHotGridSensor.cs


SensorCompressionType compression
) : base(name, cellScale, gridSize, detectableTags, compression)
{
m_DefaultObservation[0] = 1;
return DetectableTags == null ? 0 : DetectableTags.Length;
return DetectableTags == null ? 0 : (DetectableTags.Length + 1);
}
/// <inheritdoc/>

/// </param>
protected override void GetObjectData(GameObject detectedObject, int tagIndex, float[] dataBuffer)
{
dataBuffer[tagIndex] = 1;
dataBuffer[tagIndex + 1] = 1;
}
}
}
正在加载...
取消
保存