GitHub
5 年前
当前提交
53475207
共有 326 个文件被更改,包括 9280 次插入 和 10002 次删除
-
9.circleci/config.yml
-
10.gitignore
-
20CONTRIBUTING.md
-
7README.md
-
31UnitySDK/Assets/ML-Agents/Editor/Tests/EditModeTestInternalBrainTensorApplier.cs
-
97UnitySDK/Assets/ML-Agents/Editor/Tests/EditModeTestInternalBrainTensorGenerator.cs
-
138UnitySDK/Assets/ML-Agents/Editor/Tests/MultinomialTest.cs
-
237UnitySDK/Assets/ML-Agents/Editor/Tests/RandomNormalTest.cs
-
10UnitySDK/Assets/ML-Agents/Examples/3DBall/Scenes/3DBall.unity
-
10UnitySDK/Assets/ML-Agents/Examples/3DBall/Scenes/3DBallHard.unity
-
2UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAcademy.cs
-
19UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs
-
19UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DHardAgent.cs
-
926UnitySDK/Assets/ML-Agents/Examples/3DBall/TFModels/3DBallHardLearning.nn
-
724UnitySDK/Assets/ML-Agents/Examples/3DBall/TFModels/3DBallLearning.nn
-
8UnitySDK/Assets/ML-Agents/Examples/BananaCollectors/Scenes/Banana.unity
-
26UnitySDK/Assets/ML-Agents/Examples/BananaCollectors/Scripts/BananaAgent.cs
-
4UnitySDK/Assets/ML-Agents/Examples/BananaCollectors/Scripts/BananaLogic.cs
-
667UnitySDK/Assets/ML-Agents/Examples/BananaCollectors/TFModels/BananaLearning.nn
-
15UnitySDK/Assets/ML-Agents/Examples/Basic/TFModels/BasicLearning.nn
-
6UnitySDK/Assets/ML-Agents/Examples/Bouncer/Scenes/Bouncer.unity
-
8UnitySDK/Assets/ML-Agents/Examples/Bouncer/Scenes/BouncerIL.unity
-
24UnitySDK/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs
-
216UnitySDK/Assets/ML-Agents/Examples/Bouncer/TFModels/BouncerLearning.nn
-
1001UnitySDK/Assets/ML-Agents/Examples/Crawler/TFModels/CrawlerDynamicLearning.nn
-
1001UnitySDK/Assets/ML-Agents/Examples/Crawler/TFModels/CrawlerStaticLearning.nn
-
1001UnitySDK/Assets/ML-Agents/Examples/GridWorld/TFModels/GridWorldLearning.nn
-
1001UnitySDK/Assets/ML-Agents/Examples/Hallway/TFModels/HallwayLearning.nn
-
3UnitySDK/Assets/ML-Agents/Examples/PushBlock/Prefabs/PushBlockArea.prefab
-
3UnitySDK/Assets/ML-Agents/Examples/PushBlock/Prefabs/StudentArea.prefab
-
3UnitySDK/Assets/ML-Agents/Examples/PushBlock/Prefabs/TeacherArea.prefab
-
3UnitySDK/Assets/ML-Agents/Examples/PushBlock/Prefabs/VisualArea.prefab
-
10UnitySDK/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlock.unity
-
15UnitySDK/Assets/ML-Agents/Examples/PushBlock/Scenes/PushBlockIL.unity
-
10UnitySDK/Assets/ML-Agents/Examples/PushBlock/Scenes/VisualPushBlock.unity
-
37UnitySDK/Assets/ML-Agents/Examples/PushBlock/Scripts/PushAgentBasic.cs
-
1001UnitySDK/Assets/ML-Agents/Examples/PushBlock/TFModels/PushBlockLearning.nn
-
1001UnitySDK/Assets/ML-Agents/Examples/Pyramids/TFModels/PyramidsLearning.nn
-
10UnitySDK/Assets/ML-Agents/Examples/Reacher/Scenes/Reacher.unity
-
9UnitySDK/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAcademy.cs
-
40UnitySDK/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAgent.cs
-
813UnitySDK/Assets/ML-Agents/Examples/Reacher/TFModels/ReacherLearning.nn
-
9UnitySDK/Assets/ML-Agents/Examples/SharedAssets/Scripts/RayPerception2D.cs
-
23UnitySDK/Assets/ML-Agents/Examples/SharedAssets/Scripts/RayPerception3D.cs
-
6UnitySDK/Assets/ML-Agents/Examples/Soccer/Scenes/SoccerTwos.unity
-
18UnitySDK/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs
-
2UnitySDK/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerAcademy.cs
-
25UnitySDK/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerFieldArea.cs
-
1001UnitySDK/Assets/ML-Agents/Examples/Soccer/TFModels/GoalieLearning.nn
-
1001UnitySDK/Assets/ML-Agents/Examples/Soccer/TFModels/StrikerLearning.nn
-
8UnitySDK/Assets/ML-Agents/Examples/Tennis/Scenes/Tennis.unity
-
18UnitySDK/Assets/ML-Agents/Examples/Tennis/Scenes/TennisIL.unity
-
2UnitySDK/Assets/ML-Agents/Examples/Tennis/Scripts/HitWall.cs
-
1UnitySDK/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAcademy.cs
-
40UnitySDK/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs
-
830UnitySDK/Assets/ML-Agents/Examples/Tennis/TFModels/TennisLearning.nn
-
10UnitySDK/Assets/ML-Agents/Examples/Walker/Scenes/Walker.unity
-
1UnitySDK/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAcademy.cs
-
28UnitySDK/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs
-
1001UnitySDK/Assets/ML-Agents/Examples/WallJump/TFModels/BigWallJumpLearning.nn
-
1001UnitySDK/Assets/ML-Agents/Examples/WallJump/TFModels/SmallWallJumpLearning.nn
-
972UnitySDK/Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Barracuda.dll
-
252UnitySDK/Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/Conv.compute
-
994UnitySDK/Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/Dense.compute
-
74UnitySDK/Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/Generic.compute
-
15UnitySDK/Assets/ML-Agents/Plugins/Barracuda.Core/ReleaseNotes.md
-
2UnitySDK/Assets/ML-Agents/Plugins/Barracuda.Core/package.json
-
2UnitySDK/Assets/ML-Agents/Scripts/Academy.cs
-
56UnitySDK/Assets/ML-Agents/Scripts/Agent.cs
-
68UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/ApplierImpl.cs
-
140UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/BarracudaModelParamLoader.cs
-
156UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/GeneratorImpl.cs
-
55UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/ModelParamLoader.cs
-
41UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/TFSharpInferenceEngine.cs
-
41UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/TensorApplier.cs
-
217UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/TensorGenerator.cs
-
2UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/TensorNames.cs
-
31UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/Utils/Multinomial.cs
-
46UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/Utils/RandomNormal.cs
-
86UnitySDK/Assets/ML-Agents/Scripts/LearningBrain.cs
-
92UnitySDK/Assets/ML-Agents/Scripts/Utilities.cs
-
76config/trainer_config.yaml
-
2docs/Background-Machine-Learning.md
-
2docs/Creating-Custom-Protobuf-Messages.md
-
19docs/Installation.md
-
134docs/Learning-Environment-Examples.md
-
27docs/ML-Agents-Overview.md
-
21docs/Migrating.md
-
1docs/Readme.md
-
170docs/Training-Imitation-Learning.md
-
67docs/Training-ML-Agents.md
-
115docs/Training-PPO.md
-
28docs/Training-on-Amazon-Web-Service.md
-
2docs/Training-on-Microsoft-Azure.md
-
23docs/Using-Docker.md
-
2docs/localized/zh-CN/README.md
-
23gym-unity/gym_unity/envs/unity_env.py
-
4gym-unity/setup.py
-
4ml-agents-envs/mlagents/envs/__init__.py
|
|||
using System; |
|||
using System; |
|||
using Barracuda; |
|||
|
|||
public class RandomNormalTest |
|||
{ |
|||
public class RandomNormalTest |
|||
{ |
|||
[Test] |
|||
public void RandomNormalTestTwoDouble() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(2018); |
|||
private const float firstValue = -1.19580f; |
|||
private const float secondValue = -0.97345f; |
|||
private const double epsilon = 0.0001; |
|||
Assert.AreEqual(-0.46666, rn.NextDouble(), 0.0001); |
|||
Assert.AreEqual(-0.37989, rn.NextDouble(), 0.0001); |
|||
} |
|||
[Test] |
|||
public void RandomNormalTestTwoDouble() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(2018); |
|||
[Test] |
|||
public void RandomNormalTestWithMean() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(2018, 5.0f); |
|||
Assert.AreEqual(firstValue, rn.NextDouble(), epsilon); |
|||
Assert.AreEqual(secondValue, rn.NextDouble(), epsilon); |
|||
} |
|||
Assert.AreEqual(4.53333, rn.NextDouble(), 0.0001); |
|||
Assert.AreEqual(4.6201, rn.NextDouble(), 0.0001); |
|||
} |
|||
[Test] |
|||
public void RandomNormalTestWithMean() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(2018, 5.0f); |
|||
|
|||
Assert.AreEqual(firstValue + 5.0, rn.NextDouble(), epsilon); |
|||
Assert.AreEqual(secondValue + 5.0, rn.NextDouble(), epsilon); |
|||
} |
|||
|
|||
[Test] |
|||
public void RandomNormalTestWithStddev() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(2018, 0.0f, 4.2f); |
|||
|
|||
Assert.AreEqual(firstValue * 4.2, rn.NextDouble(), epsilon); |
|||
Assert.AreEqual(secondValue * 4.2, rn.NextDouble(), epsilon); |
|||
} |
|||
|
|||
[Test] |
|||
public void RandomNormalTestWithMeanStddev() |
|||
{ |
|||
float mean = -3.2f; |
|||
float stddev = 2.2f; |
|||
RandomNormal rn = new RandomNormal(2018, mean, stddev); |
|||
|
|||
Assert.AreEqual(firstValue * stddev + mean, rn.NextDouble(), epsilon); |
|||
Assert.AreEqual(secondValue * stddev + mean, rn.NextDouble(), epsilon); |
|||
} |
|||
|
|||
[Test] |
|||
public void RandomNormalTestTensorInt() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(1982); |
|||
TensorProxy t = new TensorProxy |
|||
{ |
|||
ValueType = TensorProxy.TensorType.Integer |
|||
}; |
|||
[Test] |
|||
public void RandomNormalTestWithStddev() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(2018, 1.0f, 4.2f); |
|||
Assert.Throws<NotImplementedException>(() => rn.FillTensor(t)); |
|||
} |
|||
Assert.AreEqual(-0.9599, rn.NextDouble(), 0.0001); |
|||
Assert.AreEqual(-0.5955, rn.NextDouble(), 0.0001); |
|||
} |
|||
[Test] |
|||
public void RandomNormalTestDataNull() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(1982); |
|||
TensorProxy t = new TensorProxy |
|||
{ |
|||
ValueType = TensorProxy.TensorType.FloatingPoint |
|||
}; |
|||
[Test] |
|||
public void RandomNormalTestWithMeanStddev() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(2018, -3.2f, 2.2f); |
|||
Assert.Throws<ArgumentNullException>(() => rn.FillTensor(t)); |
|||
} |
|||
Assert.AreEqual(-4.2266, rn.NextDouble(), 0.0001); |
|||
Assert.AreEqual(-4.0357, rn.NextDouble(), 0.0001); |
|||
} |
|||
[Test] |
|||
public void RandomNormalTestDistribution() |
|||
{ |
|||
float mean = -3.2f; |
|||
float stddev = 2.2f; |
|||
RandomNormal rn = new RandomNormal(2018, mean, stddev); |
|||
[Test] |
|||
public void RandomNormalTestTensorInt() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(1982); |
|||
Tensor t = new Tensor |
|||
{ |
|||
ValueType = Tensor.TensorType.Integer |
|||
}; |
|||
int numSamples = 100000; |
|||
// Adapted from https://www.johndcook.com/blog/standard_deviation/
|
|||
// Computes stddev and mean without losing precision
|
|||
double oldM = 0.0, newM = 0.0, oldS = 0.0, newS = 0.0; |
|||
Assert.Throws<NotImplementedException>(() => rn.FillTensor(t)); |
|||
} |
|||
for (int i = 0; i < numSamples; i++) |
|||
{ |
|||
double x = rn.NextDouble(); |
|||
if (i == 0) |
|||
{ |
|||
oldM = newM = x; |
|||
oldS = 0.0; |
|||
} |
|||
else |
|||
{ |
|||
newM = oldM + (x - oldM) / i; |
|||
newS = oldS + (x - oldM) * (x - newM); |
|||
[Test] |
|||
public void RandomNormalTestDataNull() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(1982); |
|||
Tensor t = new Tensor |
|||
{ |
|||
ValueType = Tensor.TensorType.FloatingPoint |
|||
}; |
|||
// set up for next iteration
|
|||
oldM = newM; |
|||
oldS = newS; |
|||
} |
|||
} |
|||
Assert.Throws<ArgumentNullException>(() => rn.FillTensor(t)); |
|||
} |
|||
double sampleMean = newM; |
|||
double sampleVariance = newS / (numSamples - 1); |
|||
double sampleStddev = Math.Sqrt(sampleVariance); |
|||
[Test] |
|||
public void RandomNormalTestTensor() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(1982); |
|||
Tensor t = new Tensor |
|||
{ |
|||
ValueType = Tensor.TensorType.FloatingPoint, |
|||
Data = Array.CreateInstance(typeof(float), new long[3] {3, 4, 2}) |
|||
}; |
|||
// Note a larger epsilon here. We could get closer to the true values with more samples.
|
|||
Assert.AreEqual(mean, sampleMean, 0.01); |
|||
Assert.AreEqual(stddev, sampleStddev, 0.01); |
|||
rn.FillTensor(t); |
|||
} |
|||
float[] reference = new float[] |
|||
{ |
|||
-0.2139822f, |
|||
0.5051259f, |
|||
-0.5640336f, |
|||
-0.3357787f, |
|||
-0.2055894f, |
|||
-0.09432302f, |
|||
-0.01419199f, |
|||
0.53621f, |
|||
-0.5507085f, |
|||
-0.2651141f, |
|||
0.09315512f, |
|||
-0.04918706f, |
|||
-0.179625f, |
|||
0.2280539f, |
|||
0.1883962f, |
|||
0.4047216f, |
|||
0.1704049f, |
|||
0.5050544f, |
|||
-0.3365685f, |
|||
0.3542781f, |
|||
0.5951571f, |
|||
0.03460682f, |
|||
-0.5537263f, |
|||
-0.4378373f, |
|||
}; |
|||
[Test] |
|||
public void RandomNormalTestTensor() |
|||
{ |
|||
RandomNormal rn = new RandomNormal(1982); |
|||
TensorProxy t = new TensorProxy |
|||
{ |
|||
ValueType = TensorProxy.TensorType.FloatingPoint, |
|||
Data = new Tensor(1, 3, 4, 2) |
|||
}; |
|||
int i = 0; |
|||
foreach (float f in t.Data) |
|||
{ |
|||
Assert.AreEqual(f, reference[i], 0.0001); |
|||
++i; |
|||
} |
|||
rn.FillTensor(t); |
|||
float[] reference = new float[] |
|||
{ |
|||
-0.4315872f, |
|||
-1.11074f, |
|||
0.3414804f, |
|||
-1.130287f, |
|||
0.1413168f, |
|||
-0.5105762f, |
|||
-0.3027347f, |
|||
-0.2645015f, |
|||
1.225356f, |
|||
-0.02921959f, |
|||
0.3716498f, |
|||
-1.092338f, |
|||
0.9561074f, |
|||
-0.5018106f, |
|||
1.167787f, |
|||
-0.7763879f, |
|||
-0.07491868f, |
|||
0.5396146f, |
|||
-0.1377991f, |
|||
0.3331701f, |
|||
0.06144788f, |
|||
0.9520947f, |
|||
1.088157f, |
|||
-1.177194f, |
|||
}; |
|||
} |
|||
} |
|||
for (var i = 0; i < t.Data.length; i++) |
|||
{ |
|||
Assert.AreEqual(t.Data[i], reference[i], 0.0001); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
vector_observation ���� - epsilon ���� action action_probs value_estimate % action_output_shape� ���� �? action_output_shape memory_size version_number is_continuous_control global_step running_variance - - Log/x 2 log_sigma_squared 3 clip_by_value/Minimum/y 5 clip_by_value/y 6 mul_4/x 7 normalized_state/Minimum/y 8 running_mean - 9 - add_2/y f mul_3/x g mul_2/x h truediv_3/y i normalized_state/y j sub_3e ���� �? vector_observation running_mean add_2d ���� �? global_step add_2/y truediv_1g ���� �? running_variance add_2 Sqrt2 o ���� �? truediv_1 truediv_2g ���� �? sub_3 Sqrt normalized_state/Minimumn ���� �? truediv_2 normalized_state/Minimum/y normalized_stateo ���� �? normalized_state/Minimum normalized_state/y main_graph_0/hidden_0/BiasAdd ���� �? normalized_state main_graph_0/hidden_0/kernel - � k � main_graph_0/hidden_0/bias � � � main_graph_0/hidden_0/Mul2 ���� �? main_graph_0/hidden_0/BiasAdd main_graph_0/hidden_1/BiasAdd ���� �? main_graph_0/hidden_0/Mul main_graph_0/hidden_1/kernel � � k @ main_graph_0/hidden_1/bias � kW � main_graph_0/hidden_1/Mul2 ���� �? main_graph_0/hidden_1/BiasAdd main_graph_1/hidden_0/BiasAdd ���� �? normalized_state main_graph_1/hidden_0/kernel - � �W � main_graph_1/hidden_0/bias � kn � main_graph_1/hidden_0/Mul2 ���� �? main_graph_1/hidden_0/BiasAdd main_graph_1/hidden_1/BiasAdd ���� �? main_graph_1/hidden_0/Mul main_graph_1/hidden_1/kernel � � �n @ main_graph_1/hidden_1/bias � �� � main_graph_1/hidden_1/Mul2 ���� �? main_graph_1/hidden_1/BiasAdd
dense/BiasAdd ���� �? main_graph_0/hidden_1/Mul dense/kernel � k� |
|||
|