Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix all PVS and doc generation warnings #5262

Merged
merged 1 commit into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions com.unity.ml-agents/Runtime/Actuators/ActionSegment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,29 @@ public bool IsEmpty()
return Array == null || Array.Length == 0;
}

/// <inheritdoc/>
/// <summary>
/// Returns an enumerator that iterates through the ActionSegment.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/// </summary>
/// <returns>An IEnumerator object that can be used to iterate through the ActionSegment.</returns>
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return new Enumerator(this);
}

/// <inheritdoc/>
/// <summary>
/// Returns an enumerator that iterates through the ActionSegment.
/// </summary>
/// <returns>An IEnumerator object that can be used to iterate through the ActionSegment.</returns>
public IEnumerator GetEnumerator()
{
return new Enumerator(this);
}

/// <inheritdoc/>
/// <summary>
/// Indicates whether the current ActionSegment is equal to another ActionSegment.
/// </summary>
/// <param name="obj">An ActionSegment to compare with this ActionSegment.</param>
/// <returns>true if the current ActionSegment is equal to the other parameter; otherwise, false.</returns>
public override bool Equals(object obj)
{
if (!(obj is ActionSegment<T>))
Expand All @@ -138,13 +148,20 @@ public override bool Equals(object obj)
return Equals((ActionSegment<T>)obj);
}

/// <inheritdoc/>
/// <summary>
/// Indicates whether the current ActionSegment is equal to another ActionSegment.
/// </summary>
/// <param name="other">An ActionSegment to compare with this ActionSegment.</param>
/// <returns>true if the current ActionSegment is equal to the other parameter; otherwise, false.</returns>
public bool Equals(ActionSegment<T> other)
{
return Offset == other.Offset && Length == other.Length && Array.SequenceEqual(other.Array);
}

/// <inheritdoc/>
/// <summary>
/// Computes the hash code of the ActionSegment.
/// </summary>
/// <returns>A hash code for the current ActionSegment.</returns>
public override int GetHashCode()
{
unchecked
Expand Down
11 changes: 9 additions & 2 deletions com.unity.ml-agents/Runtime/Actuators/IActionReceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ public bool IsEmpty()
return ContinuousActions.IsEmpty() && DiscreteActions.IsEmpty();
}

/// <inheritdoc/>
/// <summary>
/// Indicates whether the current ActionBuffers is equal to another ActionBuffers.
/// </summary>
/// <param name="obj">An ActionBuffers to compare with this ActionBuffers.</param>
/// <returns>true if the current ActionBuffers is equal to the other parameter; otherwise, false.</returns>
public override bool Equals(object obj)
{
if (!(obj is ActionBuffers))
Expand All @@ -140,7 +144,10 @@ public override bool Equals(object obj)
ab.DiscreteActions.SequenceEqual(DiscreteActions);
}

/// <inheritdoc/>
/// <summary>
/// Computes the hash code of the ActionBuffers.
/// </summary>
/// <returns>A hash code for the current ActionBuffers.</returns>
public override int GetHashCode()
{
unchecked
Expand Down
2 changes: 1 addition & 1 deletion com.unity.ml-agents/Runtime/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ void ResetSensors()
/// - <see cref="VectorSensor.AddObservation(Vector2)"/>
/// - <see cref="VectorSensor.AddObservation(Quaternion)"/>
/// - <see cref="VectorSensor.AddObservation(bool)"/>
/// - <see cref="VectorSensor.AddObservation(IEnumerable{float})"/>
/// - <see cref="VectorSensor.AddObservation(IList{float})"/>
/// - <see cref="VectorSensor.AddOneHotObservation(int, int)"/>
///
/// You can use any combination of these helper functions to build the agent's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class BufferSensorComponent : SensorComponent
{

/// <summary>
/// Name of the generated <see cref="bufferSensor"/> object.
/// Name of the generated <see cref="BufferSensor"/> object.
/// Note that changing this at runtime does not affect how the Agent sorts the sensors.
/// </summary>
public string SensorName
Expand Down
4 changes: 4 additions & 0 deletions com.unity.ml-agents/Runtime/Sensors/CompressionSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,17 @@ public SensorCompressionType SensorCompressionType

internal int[] m_CompressedChannelMapping;

/// <summary>
/// The mapping of the channels in compressed data to the actual channel after decompression.
/// </summary>
/// <remarks>
/// The mapping is a list of integer index with the same length as
/// the number of output observation layers (channels), including padding if there's any.
/// Each index indicates the actual channel the layer will go into.
/// Layers with the same index will be averaged, and layers with negative index will be dropped.
/// For example, mapping for CameraSensor using grayscale and stacking of two: [0, 0, 0, 1, 1, 1]
/// Mapping for GridSensor of 4 channels and stacking of two: [0, 1, 2, 3, -1, -1, 4, 5, 6, 7, -1, -1]
/// </remarks>
public int[] CompressedChannelMapping
{
get => m_CompressedChannelMapping;
Expand Down
1 change: 1 addition & 0 deletions com.unity.ml-agents/Runtime/Sensors/StackingSensor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ public byte[] GetCompressedObservation()
return outputBytes;
}

/// <inheritdoc/>
public CompressionSpec GetCompressionSpec()
{
var wrappedSpec = m_WrappedSensor.GetCompressionSpec();
Expand Down
1 change: 1 addition & 0 deletions com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class VectorSensor : ISensor, IBuiltInSensor
/// </summary>
/// <param name="observationSize">Number of vector observations.</param>
/// <param name="name">Name of the sensor.</param>
/// <param name="observationType"></param>
public VectorSensor(int observationSize, string name = null, ObservationType observationType = ObservationType.Default)
{
if (string.IsNullOrEmpty(name))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public override ISensor[] CreateSensors()
/// <summary>
/// Returns the underlying VectorSensor
/// </summary>
/// <returns></returns>
public VectorSensor GetSensor()
{
return m_Sensor;
Expand Down