Skip to content

Reducing complexity on a number of classes. #2480

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 13 commits into from
Sep 11, 2019
Merged

Conversation

mmattar
Copy link

@mmattar mmattar commented Sep 1, 2019

There are no functional changes in any of the modifications in this PR. The individual commit messages contain detailed descriptions of each incremental commit.

Marwan Mattar added 12 commits August 31, 2019 12:38
Only cosmetic and readability improvements. No functional changes were intended.

Utilities.cs
- Fixed comments across file
- Made class static
- Removed unnecessary imports
- Removed unused method arguments
- Renamed variables as appropriate to make usage clearer
- In AddRangeNoAlloc, disabled (by comment) Rider’s suggestion to revert to use of built-in Range field (Fixed)
- In TextureToTensorProxy, swapped order of first two arguments to be more in-line with convention of input, output

UtilitiesTests.cs
- Removed unnecessary imports
- Simplified array creation commands

GeneratorImp.cs
- Rider automatically deleted spaces on empty lines
- Changed call to TextureToTensorProxy to mirror new argument ordering
- Removed unnecessary imports
- Fixed comment warning
- Fixed method header
- Created const for SCENE_NAME field
- Fixed string formatting for exception message
- Added new line at EOF
- Removed FillTensor from RandomNormal and moved to TensorUtils
- Removed the tests in RandomNormalTest that are for FillTensor to TensorUtilsTest
- Fixed GeneratorImpl to use to TensorUtils.FillTensor method
- Add use of var where appropriate
- Makes variables readonly where appropriate
- Makes private variables start with “_”
- Removes DiscreteActionOutputApplier context from Multinomial - class is much simpler now
- Moves most of the tests in MultinomialTest to a new DiscreteActionOutputApplierTest class
- Adds a basic Multinomial test to MultinomialTest
- Limiting code to 100 characters
- renaming private vars to start with “_”
- fixing indentation in file

Couple of other minor fixes to TensorUtilsTest and Discrete…Test.cs
Changed Name —> name; ValueType —> valueType; Shape —> shape; Data —> data
- Limit to 100 chars per line
- Appropriate formatting
- Removed Rider warnings
@CLAassistant
Copy link

CLAassistant commented Sep 1, 2019

CLA assistant check
All committers have signed the CLA.

@@ -0,0 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this file for ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Rider project file

Copy link
Author

Choose a reason for hiding this comment

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

Yes, this Rider file includes words added to the Rider dictionary.

@@ -194,14 +197,15 @@ public void Generate(TensorProxy tensorProxy, int batchSize, Dictionary<Agent, A
/// </summary>
public class PreviousActionInputGenerator : TensorGenerator.Generator
{
private ITensorAllocator _allocator;
private readonly ITensorAllocator _allocator;
Copy link
Contributor

Choose a reason for hiding this comment

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

You should ask a review to Mantas about this

@@ -1,6 +1,5 @@
using System;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer to keep those for reference.

};
var batchSize = 4;
const int batchSize = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the general guideline for when to use var? You move some things to it, and others (like here) away from it.

Copy link
Contributor

Choose a reason for hiding this comment

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

because const

Copy link
Contributor

Choose a reason for hiding this comment

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

The general guideline is to use it when the variable left type matches the right type.

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

Fixed the tests for Multinomial as they didn’t include cumulative mass functions.

Also, improved the documentation.
@mmattar
Copy link
Author

mmattar commented Sep 9, 2019

@surfnerd / @vincentpierre - realized that my editor tests weren't passing, made the appropriate fix to tests and added relevant documentation.

@surfnerd
Copy link
Contributor

changes look good

@mmattar mmattar merged commit 4a414cc into develop Sep 11, 2019
surfnerd pushed a commit that referenced this pull request Sep 12, 2019
Only cosmetic and readability improvements. No functional changes were intended.

Utilities.cs
- Fixed comments across file
- Made class static
- Removed unnecessary imports
- Removed unused method arguments
- Renamed variables as appropriate to make usage clearer
- In AddRangeNoAlloc, disabled (by comment) Rider’s suggestion to revert to use of built-in Range field (Fixed)
- In TextureToTensorProxy, swapped order of first two arguments to be more in-line with convention of input, output

UtilitiesTests.cs
- Removed unnecessary imports
- Simplified array creation commands

GeneratorImp.cs
- Rider automatically deleted spaces on empty lines
- Changed call to TextureToTensorProxy to mirror new argument ordering

* Clean-up to UnityAgentsException.cs

- Removed unnecessary imports
- Fixed comment warning
- Fixed method header

* Improvements to Startup.cs

- Created const for SCENE_NAME field
- Fixed string formatting for exception message
- Added new line at EOF

* Adding team-wide settings file

* Clean up to RandomNormal

- Removed FillTensor from RandomNormal and moved to TensorUtils
- Removed the tests in RandomNormalTest that are for FillTensor to TensorUtilsTest
- Fixed GeneratorImpl to use to TensorUtils.FillTensor method

* Decouples DiscreteActionOutputApplier from Multinomial

- Add use of var where appropriate
- Makes variables readonly where appropriate
- Makes private variables start with “_”
- Removes DiscreteActionOutputApplier context from Multinomial - class is much simpler now
- Moves most of the tests in MultinomialTest to a new DiscreteActionOutputApplierTest class
- Adds a basic Multinomial test to MultinomialTest

* Minor formatting to TensorProxy

- Limiting code to 100 characters
- renaming private vars to start with “_”
- fixing indentation in file

Couple of other minor fixes to TensorUtilsTest and Discrete…Test.cs

* Adding new line to EOF for TensorProxy

* Adding missing meta files.

* Removing three unused methods from TensorProxy

* (Big) Rename of TensorProxy fields

Changed Name —> name; ValueType —> valueType; Shape —> shape; Data —> data

* Additional cosmetic changes to a number of files previously modified

- Limit to 100 chars per line
- Appropriate formatting
- Removed Rider warnings

* Improvements to Multinomial(Test).cs

Fixed the tests for Multinomial as they didn’t include cumulative mass functions.

Also, improved the documentation.
@mmattar mmattar deleted the develop-cosmetic-fixes branch September 13, 2019 00:43
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 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.

5 participants