-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add SensorShapeValidator unit #3504
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
Conversation
| // TODO make sure this only checks once per agent | ||
| Debug.Assert(m_SensorShapes.Count == sensors.Count, $"Number of Sensors must match. {m_SensorShapes.Count} != {sensors.Count}"); | ||
| for (var i = 0; i < m_SensorShapes.Count; i++) | ||
| for (var i = 0; i < Mathf.Min(m_SensorShapes.Count, sensors.Count); i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these differed before, we'd get the assert, but would potentially continue and iterate through the lists, so accessing sensors[i] would read past the end of the list.
| string m_Name = "NoopSensor"; | ||
| int[] m_Shape; | ||
|
|
||
| public NoopSensor(int dim1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some convenience methods for making sensors of a certain size.
|
|
||
| namespace MLAgents.Tests | ||
| { | ||
| public class NoopSensor : ISensor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a Noop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can rename to DummySensor or something clearer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NoOpSensor?
Proposed change(s)
Add unit tests for SensorShapeValidator, fix potential errors.
Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)
Types of change(s)
Checklist
Other comments