Skip to content

[MLA-1824] make SensorComponent return ISensor[] #5181

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

Merged
merged 4 commits into from
Mar 23, 2021

Conversation

chriselion
Copy link
Contributor

@chriselion chriselion commented Mar 23, 2021

Proposed change(s)

  • Changes SensorComponent to return an array of sensors instead of just 1.
  • Update Match3 sensors to only operate on one of cell values or special values at a time. Match3SensorComponent will return a sensor for cell values, and another for special values (if there are any). Note that this invalidates previously trained models.

Note that Match3 models were only retrained partially, since I expect them to change again soon.

Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)

https://jira.unity3d.com/browse/MLA-1824

Types of change(s)

  • Code refactor
  • Breaking change

Checklist

  • Added tests that prove my fix is effective or that my feature works
  • Updated the changelog (if applicable)
  • Updated the migration guide (if applicable)

Other comments

@chriselion chriselion requested a review from surfnerd March 23, 2021 17:34
@chriselion chriselion changed the title Mla 1824 sensor compnent array [MLA-1824] make SensorComponent return ISensor[] Mar 23, 2021
$"Current shape: Rows={m_Board.Rows} Columns={m_Board.Columns}, NumCellTypes={m_Board.NumCellTypes}"
);
}
// if (m_Board.Rows != m_Rows || m_Board.Columns != m_Columns || m_Board.NumCellTypes != m_NumCellTypes)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Disabled for now, might return later (depending on how I handle multiple board sizes)

for (var i = 0; i < m_NumCellTypes; i++)
var val = m_GridValues(r, c);

for (var i = 0; i < m_OneHotSize; i++)
Copy link
Contributor

Choose a reason for hiding this comment

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

does this loop exist to 0 out the rest of one-hots? Could it be simplified to something like:

writer[offset + val] = 1.0f;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, as long as we know the memory is initialized to zero, we could do that (plus an extra check that val < m_OneHotSize)

Copy link
Contributor

@surfnerd surfnerd left a comment

Choose a reason for hiding this comment

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

LGTM

@chriselion chriselion merged commit e4e9c51 into main Mar 23, 2021
@delete-merged-branch delete-merged-branch bot deleted the MLA-1824-SensorCompnent-array branch March 23, 2021 20:14
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants