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

Make ActionSpec ctor public #4896

Merged
merged 3 commits into from
Jan 29, 2021
Merged

Make ActionSpec ctor public #4896

merged 3 commits into from
Jan 29, 2021

Conversation

chriselion
Copy link
Contributor

@chriselion chriselion commented Jan 29, 2021

Proposed change(s)

We don't currently have any way to create an ActionSpec from code that uses both discrete and continuous actions. This makes the previously internal constructor public, and adds it to the public API test.

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

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

Types of change(s)

  • Bug fix

Checklist

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

@@ -66,10 +66,17 @@ public static ActionSpec MakeDiscrete(params int[] branchSizes)
return actuatorSpace;
}

internal ActionSpec(int numContinuousActions, int[] branchSizes = null)
/// <summary>
/// Create an ActionSpec initialized with the specified action sizes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to propose adding "Writing docstrings for constructors" to the list of "Hard things in Computer Science".

/// <param name="discreteBranchSizes">The array of branch sizes for the discrete actions. Each index
/// contains the number of actions available for that branch.</param>
/// <returns>An ActionSpec initialized with the specified action sizes.</returns>
public ActionSpec(int numContinuousActions = 0, int[] discreteBranchSizes = null)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

MakeDiscrete uses the params int[] syntactic sugar, but I feel like adding that here is potentially confusing.

@chriselion chriselion merged commit 26a7040 into master Jan 29, 2021
@delete-merged-branch delete-merged-branch bot deleted the MLA-1740-hybrid-action-ctor branch January 29, 2021 19:12
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 29, 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.

3 participants