Skip to content

Conversation

@chriselion
Copy link
Contributor

Proposed change(s)

  • Doc cleanup
  • Don't call legacy methods if using continuous + discrete actions - this isn't a behavior change since the old combination wasn't possible
  • Warn if calling GetAction() with continuous + discrete
  • Mark SpaceType as obsolete.

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

Types of change(s)

  • Bug fix
  • New feature
  • Code refactor
  • Breaking change
  • Documentation update
  • Other (please describe)

Checklist

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

Other comments

/// </item>
/// <item>
/// <term>1.3.0</term>
/// <description>Support action spaces with both continuous and discrete actions.</description>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Continuing my war on space.

internal struct AgentInfo
{
/// <summary>
/// Keeps track of the last vector action taken by the Brain.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

... and my war on "vector action"

/// Keeps track of the last vector action taken by the Brain.
/// Keeps track of the last actions taken by the Brain.
/// </summary>
public ActionBuffers storedVectorActions;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

public field in an internal struct, so this is OK to rename.

var brainParams = m_PolicyFactory.BrainParameters;
var actionSpec = brainParams.ActionSpec;
// For continuous and discrete actions together, we don't need to fall back to the legacy method
if (actionSpec.NumContinuousActions > 0 && actionSpec.NumDiscreteActions > 0)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Better to avoid any confusion here - don't call the float[] version if we're using continuous + discrete (plus avoid munging the arrays)

}
}
using (TimerStack.Instance.Scoped("CollectDiscreteActionMasks"))
using (TimerStack.Instance.Scoped("WriteActionMask"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Old name

// For continuous and discrete actions together, this shouldn't be called because we can only return one.
if (actionSpec.NumContinuousActions > 0 && actionSpec.NumDiscreteActions > 0)
{
Debug.LogWarning("Agent.GetAction() when both continuous and discrete actions are in use. Use Agent.GetStoredActionBuffers() instead.");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if we should throw or log here.

}

[Test]
public void TestAllowMixedActions()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A version of this (that checked for failure) was removed in the hybrid action PR. Adding it back to make sure we can do it.

@chriselion chriselion merged commit 27f7156 into release_11_branch Dec 18, 2020
@delete-merged-branch delete-merged-branch bot deleted the hybrid-action-followup branch December 18, 2020 18:29
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 18, 2021
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.

3 participants