GitHub
5 年前
当前提交
d985dded
共有 66 个文件被更改,包括 1302 次插入 和 969 次删除
-
2.circleci/config.yml
-
1.gitignore
-
2.pre-commit-config.yaml
-
4UnitySDK/Assets/ML-Agents/Editor/DemonstrationImporter.cs
-
2UnitySDK/Assets/ML-Agents/Editor/Tests/MLAgentsEditModeTest.cs
-
2UnitySDK/Assets/ML-Agents/Editor/Tests/Sensor/StackingSensorTests.cs
-
2UnitySDK/Assets/ML-Agents/Editor/Tests/Sensor/VectorSensorTests.cs
-
12UnitySDK/Assets/ML-Agents/Editor/Tests/Sensor/WriterAdapterTests.cs
-
7UnitySDK/Assets/ML-Agents/Editor/Tests/StandaloneBuildTest.cs
-
673UnitySDK/Assets/ML-Agents/Examples/GridWorld/Scenes/GridWorld.unity
-
9UnitySDK/Assets/ML-Agents/Scripts/Agent.cs
-
19UnitySDK/Assets/ML-Agents/Scripts/Grpc/RpcCommunicator.cs
-
5UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/GeneratorImpl.cs
-
2UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/TensorGenerator.cs
-
4UnitySDK/Assets/ML-Agents/Scripts/Policy/BarracudaPolicy.cs
-
4UnitySDK/Assets/ML-Agents/Scripts/Policy/RemotePolicy.cs
-
9UnitySDK/Assets/ML-Agents/Scripts/Sensor/CameraSensor.cs
-
3UnitySDK/Assets/ML-Agents/Scripts/Sensor/CameraSensorComponent.cs
-
4UnitySDK/Assets/ML-Agents/Scripts/Sensor/ISensor.cs
-
2UnitySDK/Assets/ML-Agents/Scripts/Sensor/RayPerceptionSensor.cs
-
11UnitySDK/Assets/ML-Agents/Scripts/Sensor/RenderTextureSensor.cs
-
3UnitySDK/Assets/ML-Agents/Scripts/Sensor/RenderTextureSensorComponent.cs
-
6UnitySDK/Assets/ML-Agents/Scripts/Sensor/SensorBase.cs
-
7UnitySDK/Assets/ML-Agents/Scripts/Sensor/StackingSensor.cs
-
2UnitySDK/Assets/ML-Agents/Scripts/Sensor/VectorSensor.cs
-
53UnitySDK/Assets/ML-Agents/Scripts/Sensor/WriteAdapter.cs
-
71config/sac_trainer_config.yaml
-
72config/trainer_config.yaml
-
5docs/Learning-Environment-Create-New.md
-
11docs/Migrating.md
-
4docs/Training-ML-Agents.md
-
2gym-unity/gym_unity/tests/test_gym.py
-
8ml-agents-envs/mlagents_envs/exception.py
-
43ml-agents-envs/mlagents_envs/rpc_utils.py
-
2ml-agents-envs/mlagents_envs/tests/test_envs.py
-
43ml-agents-envs/mlagents_envs/tests/test_rpc_utils.py
-
84ml-agents/mlagents/trainers/agent_processor.py
-
32ml-agents/mlagents/trainers/brain.py
-
58ml-agents/mlagents/trainers/curriculum.py
-
78ml-agents/mlagents/trainers/learn.py
-
118ml-agents/mlagents/trainers/meta_curriculum.py
-
9ml-agents/mlagents/trainers/ppo/trainer.py
-
14ml-agents/mlagents/trainers/rl_trainer.py
-
9ml-agents/mlagents/trainers/sac/trainer.py
-
13ml-agents/mlagents/trainers/stats.py
-
2ml-agents/mlagents/trainers/tests/mock_brain.py
-
41ml-agents/mlagents/trainers/tests/test_agent_processor.py
-
2ml-agents/mlagents/trainers/tests/test_bcmodule.py
-
32ml-agents/mlagents/trainers/tests/test_curriculum.py
-
11ml-agents/mlagents/trainers/tests/test_learn.py
-
56ml-agents/mlagents/trainers/tests/test_meta_curriculum.py
-
2ml-agents/mlagents/trainers/tests/test_multigpu.py
-
38ml-agents/mlagents/trainers/tests/test_ppo.py
-
2ml-agents/mlagents/trainers/tests/test_reward_signals.py
-
39ml-agents/mlagents/trainers/tests/test_rl_trainer.py
-
12ml-agents/mlagents/trainers/tests/test_sac.py
-
2ml-agents/mlagents/trainers/tests/test_stats.py
-
2ml-agents/mlagents/trainers/tests/test_subprocess_env_manager.py
-
28ml-agents/mlagents/trainers/tests/test_trainer_controller.py
-
2ml-agents/mlagents/trainers/tests/test_trainer_util.py
-
198ml-agents/mlagents/trainers/trainer.py
-
161ml-agents/mlagents/trainers/trainer_controller.py
-
6ml-agents/mlagents/trainers/trainer_util.py
-
1test_requirements.txt
-
105UnitySDK/Assets/ML-Agents/Editor/Tests/Sensor/FloatVisualSensorTests.cs
-
3UnitySDK/Assets/ML-Agents/Editor/Tests/Sensor/FloatVisualSensorTests.cs.meta
673
UnitySDK/Assets/ML-Agents/Examples/GridWorld/Scenes/GridWorld.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
# Test-only dependencies should go here, not in setup.py |
|||
pytest>4.0.0,<6.0.0 |
|||
pytest-cov==2.6.1 |
|||
pytest-xdist |
|
|||
using NUnit.Framework; |
|||
using UnityEngine; |
|||
using MLAgents.Sensor; |
|||
|
|||
namespace MLAgents.Tests |
|||
{ |
|||
public class Float2DSensor : ISensor |
|||
{ |
|||
public int Width { get; } |
|||
public int Height { get; } |
|||
string m_Name; |
|||
int[] m_Shape; |
|||
public float[,] floatData; |
|||
|
|||
public Float2DSensor(int width, int height, string name) |
|||
{ |
|||
Width = width; |
|||
Height = height; |
|||
m_Name = name; |
|||
m_Shape = new[] { height, width, 1 }; |
|||
floatData = new float[Height, Width]; |
|||
} |
|||
|
|||
public Float2DSensor(float[,] floatData, string name) |
|||
{ |
|||
this.floatData = floatData; |
|||
Height = floatData.GetLength(0); |
|||
Width = floatData.GetLength(1); |
|||
m_Name = name; |
|||
m_Shape = new[] { Height, Width, 1 }; |
|||
} |
|||
|
|||
public string GetName() |
|||
{ |
|||
return m_Name; |
|||
} |
|||
|
|||
public int[] GetObservationShape() |
|||
{ |
|||
return m_Shape; |
|||
} |
|||
|
|||
public byte[] GetCompressedObservation() |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
public int Write(WriteAdapter adapter) |
|||
{ |
|||
using (TimerStack.Instance.Scoped("Float2DSensor.Write")) |
|||
{ |
|||
for (var h = 0; h < Height; h++) |
|||
{ |
|||
for (var w = 0; w < Width; w++) |
|||
{ |
|||
adapter[h, w, 0] = floatData[h, w]; |
|||
} |
|||
} |
|||
var numWritten = Height * Width; |
|||
return numWritten; |
|||
} |
|||
} |
|||
|
|||
public void Update() { } |
|||
|
|||
public SensorCompressionType GetCompressionType() |
|||
{ |
|||
return SensorCompressionType.None; |
|||
} |
|||
} |
|||
|
|||
public class FloatVisualSensorTests |
|||
{ |
|||
[Test] |
|||
public void TestFloat2DSensorWrite() |
|||
{ |
|||
var sensor = new Float2DSensor(3, 4, "floatsensor"); |
|||
for (var h = 0; h < 4; h++) |
|||
{ |
|||
for (var w = 0; w < 3; w++) |
|||
{ |
|||
sensor.floatData[h, w] = 3 * h + w; |
|||
} |
|||
} |
|||
|
|||
var output = new float[12]; |
|||
var writer = new WriteAdapter(); |
|||
writer.SetTarget(output, sensor.GetObservationShape(), 0); |
|||
sensor.Write(writer); |
|||
for (var i = 0; i < 9; i++) |
|||
{ |
|||
Assert.AreEqual(i, output[i]); |
|||
} |
|||
} |
|||
|
|||
[Test] |
|||
public void TestFloat2DSensorExternalData() |
|||
{ |
|||
var data = new float[4, 3]; |
|||
var sensor = new Float2DSensor(data, "floatsensor"); |
|||
Assert.AreEqual(sensor.Height, 4); |
|||
Assert.AreEqual(sensor.Width, 3); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 49b7da14949a486b803e28ed32d91a09 |
|||
timeCreated: 1578093005 |
撰写
预览
正在加载...
取消
保存
Reference in new issue