-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[MLA-1634] Add ObservationSpec and update ISensor interfaces #5127
Changes from 21 commits
492d0b4
43abc71
40f78a9
e917a8f
e436125
aa751a1
e8403af
c79b9b4
1cf71bf
7fe748a
89018a4
30b6115
2886994
ea66b15
71266ad
44e2e61
8d1d973
ff254a8
8bfd913
dbf93c9
875e03c
0dabf84
3078dfd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
m_EditorVersion: 2019.4.19f1 | ||
m_EditorVersionWithRevision: 2019.4.19f1 (ca5b14067cec) | ||
m_EditorVersion: 2019.4.20f1 | ||
m_EditorVersionWithRevision: 2019.4.20f1 (6dd1c08eedfa) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,9 +215,9 @@ public enum GridDepthType { Channel, ChannelHot }; | |
protected bool Initialized = false; | ||
|
||
/// <summary> | ||
/// Array holding the dimensions of the resulting tensor | ||
/// Cached ObservationSpec | ||
/// </summary> | ||
private int[] m_Shape; | ||
private ObservationSpec m_ObservationSpec; | ||
|
||
// | ||
// Debug Parameters | ||
|
@@ -423,7 +423,7 @@ public virtual void Start() | |
// Default root reference to current game object | ||
if (rootReference == null) | ||
rootReference = gameObject; | ||
m_Shape = new[] { GridNumSideX, GridNumSideZ, ObservationPerCell }; | ||
m_ObservationSpec = ObservationSpec.Visual(GridNumSideX, GridNumSideZ, ObservationPerCell); | ||
|
||
compressedImgs = new List<byte[]>(); | ||
byteSizesBytesList = new List<byte[]>(); | ||
|
@@ -475,14 +475,6 @@ public void ClearPerceptionBuffer() | |
} | ||
} | ||
|
||
/// <summary>Gets the shape of the grid observation</summary> | ||
/// <returns>integer array shape of the grid observation</returns> | ||
public int[] GetFloatObservationShape() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this was unused. |
||
{ | ||
m_Shape = new[] { GridNumSideX, GridNumSideZ, ObservationPerCell }; | ||
return m_Shape; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public string GetName() | ||
{ | ||
|
@@ -914,10 +906,22 @@ void ISensor.Update() | |
|
||
/// <summary>Gets the observation shape</summary> | ||
/// <returns>int[] of the observation shape</returns> | ||
public ObservationSpec GetObservationSpec() | ||
{ | ||
// Lazy update | ||
var shape = m_ObservationSpec.Shape; | ||
if (shape[0] != GridNumSideX || shape[1] != GridNumSideZ || shape[2] != ObservationPerCell) | ||
{ | ||
m_ObservationSpec = ObservationSpec.Visual(GridNumSideX, GridNumSideZ, ObservationPerCell); | ||
} | ||
return m_ObservationSpec; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override int[] GetObservationShape() | ||
{ | ||
m_Shape = new[] { GridNumSideX, GridNumSideZ, ObservationPerCell }; | ||
return m_Shape; | ||
var shape = m_ObservationSpec.Shape; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the SensorComponent override, not sure if we should change that to return a spec too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would lean toward yes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I'm going to punt that to a separate PR. |
||
return new int[] { shape[0], shape[1], shape[2] }; | ||
} | ||
|
||
/// <inheritdoc/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ public interface IDiscreteActionMask | |
/// <summary> | ||
/// Set whether or not the action index for the given branch is allowed. | ||
/// </summary> | ||
/// <remarks> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not from here, but was broken in staging. |
||
/// By default, all discrete actions are allowed. | ||
/// If isEnabled is false, the agent will not be able to perform the actions passed as argument | ||
/// at the next decision for the specified action branch. The actionIndex correspond | ||
|
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.
Not sure what to do with this. It got added in 7718dfe#diff-41dd07c8a0392e1f6c2a7ba1277f3426cdc92aa8258e563912c39db66800ade0 but wasn't computing coverage on the assemblies we care about.
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.
yeah, I think it's just for local runs of code coverage