浏览代码

cleanup

/v2-staging-rebase
Chris Elion 4 年前
当前提交
0e24a5d6
共有 4 个文件被更改,包括 26 次插入15 次删除
  1. 1
      com.unity.ml-agents/Runtime/Sensors/CameraSensor.cs
  2. 37
      com.unity.ml-agents/Runtime/Sensors/ObservationSpec.cs
  3. 1
      com.unity.ml-agents/Runtime/Sensors/ObservationWriter.cs
  4. 2
      com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs

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


int m_Height;
bool m_Grayscale;
string m_Name;
//int[] m_Shape;
private ObservationSpec m_ObservationSpec;
SensorCompressionType m_CompressionType;

37
com.unity.ml-agents/Runtime/Sensors/ObservationSpec.cs


/// </remarks>
public InplaceArray<DimensionProperty> DimensionProperties;
/// <summary>
/// The type of the observation, e.g. whether they are generic or
/// help determine the goal for the Agent.

/// <returns></returns>
public static ObservationSpec Vector(int length)
{
InplaceArray<int> shape = new InplaceArray<int>(length);
InplaceArray<DimensionProperty> dimProps = new InplaceArray<DimensionProperty>(DimensionProperty.None);
return new ObservationSpec(shape, dimProps);
return new ObservationSpec(
new InplaceArray<int>(length),
new InplaceArray<DimensionProperty>(DimensionProperty.None)
);
}
/// <summary>

/// <returns></returns>
public static ObservationSpec VariableLength(int obsSize, int maxNumObs)
{
InplaceArray<int> shape = new InplaceArray<int>(obsSize, maxNumObs);
InplaceArray<DimensionProperty> dimProps = new InplaceArray<DimensionProperty>(DimensionProperty.VariableSize, DimensionProperty.None);
return new ObservationSpec(shape, dimProps);
var dimProps = new InplaceArray<DimensionProperty>(
DimensionProperty.VariableSize,
DimensionProperty.None
);
return new ObservationSpec(
new InplaceArray<int>(obsSize, maxNumObs),
dimProps
);
}
/// <summary>

/// <returns></returns>
public static ObservationSpec Visual(int height, int width, int channels)
{
InplaceArray<int> shape = new InplaceArray<int>(height, width, channels);
InplaceArray<DimensionProperty> dimProps = new InplaceArray<DimensionProperty>(
DimensionProperty.TranslationalEquivariance, DimensionProperty.TranslationalEquivariance, DimensionProperty.None
var dimProps = new InplaceArray<DimensionProperty>(
DimensionProperty.TranslationalEquivariance,
DimensionProperty.TranslationalEquivariance,
DimensionProperty.None
return new ObservationSpec(shape, dimProps);
return new ObservationSpec(
new InplaceArray<int>(height, width, channels),
dimProps
);
/// <remarks>
/// Note that not all combinations of DimensionProperty may be supported by the trainer.
/// shape and dimensionProperties must have the same size.
/// </remarks>
internal ObservationSpec(
public ObservationSpec(
InplaceArray<int> shape,
InplaceArray<DimensionProperty> dimensionProperties,
ObservationType observationType = ObservationType.Default

1
com.unity.ml-agents/Runtime/Sensors/ObservationWriter.cs


/// <param name="offset">Offset from the start of the float data to write to.</param>
internal void SetTarget(IList<float> data, ObservationSpec observationSpec, int offset)
{
// TODO remove int[] version
SetTarget(data, observationSpec.Shape, offset);
}

2
com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs


// TODO use float[] instead
// TODO allow setting float[]
List<float> m_Observations;
private ObservationSpec m_ObservationSpec;
ObservationSpec m_ObservationSpec;
string m_Name;
/// <summary>

正在加载...
取消
保存