using MLAgents.InferenceBrain; namespace MLAgents.Sensor { public enum CompressionType { None, PNG, } /// /// Sensor interface for generating observations. /// For custom implementations, it is recommended to SensorBase instead. /// public interface ISensor { /// /// Returns the size of the observations that will be generated. /// For example, a sensor that observes the velocity of a rigid body (in 3D) would return new {3}. /// A sensor that returns an RGB image would return new [] {Width, Height, 3} /// /// int[] GetFloatObservationShape(); /// /// Write the observation data directly to the TensorProxy. /// This is considered an advanced interface; for a simpler approach, use SensorBase and override WriteFloats instead. /// /// /// void WriteToTensor(TensorProxy tensorProxy, int agentIndex); /// /// Return a compressed representation of the observation. For small observations, this should generally not be /// implemented. However, compressing large observations (such as visual results) can significantly improve /// model training time. /// /// byte[] GetCompressedObservation(); /// /// Return the compression type being used. If no compression is used, return CompressionType.None /// /// CompressionType GetCompressionType(); /// /// Get the name of the sensor. This is used to ensure deterministic sorting of the sensors on an Agent, /// so the naming must be consistent across all sensors and agents. /// /// The name of the sensor string GetName(); } }