浏览代码

Move physics/sensor tests that fail in edit mode depending on what's in the scene to playmode tests. (#5162)

/develop/lex-walker-model
GitHub 4 年前
当前提交
221d9213
共有 45 个文件被更改,包括 332 次插入206 次删除
  1. 1
      com.unity.ml-agents.extensions/Runtime/AssemblyInfo.cs
  2. 1
      com.unity.ml-agents.extensions/Tests/Editor/Unity.ML-Agents.Extensions.EditorTests.asmdef
  3. 3
      com.unity.ml-agents.extensions/Tests/Runtime/Unity.ML-Agents.Extensions.Tests.asmdef
  4. 5
      com.unity.ml-agents/Runtime/AssemblyInfo.cs
  5. 1
      com.unity.ml-agents/Runtime/Communicator/GrpcExtensions.cs
  6. 2
      com.unity.ml-agents/Runtime/Grpc/AssemblyInfo.cs
  7. 3
      com.unity.ml-agents/Runtime/Sensors/StackingSensor.cs
  8. 1
      com.unity.ml-agents/Tests/Editor/DemonstrationTests.cs
  9. 1
      com.unity.ml-agents/Tests/Editor/Inference/EditModeTestInternalBrainTensorGenerator.cs
  10. 192
      com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs
  11. 3
      com.unity.ml-agents/Tests/Editor/Unity.ML-Agents.Editor.Tests.asmdef
  12. 2
      com.unity.ml-agents/Tests/Runtime/Unity.ML-Agents.Runtime.Tests.asmdef
  13. 2
      com.unity.ml-agents.extensions/Tests/Runtime/Sensors/PoseExtractorTests.cs.meta
  14. 2
      com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodyPoseExtractorTests.cs.meta
  15. 2
      com.unity.ml-agents.extensions/Tests/Runtime/Sensors/ArticulationBodyPoseExtractorTests.cs.meta
  16. 2
      com.unity.ml-agents.extensions/Tests/Runtime/Sensors/ArticulationBodySensorTests.cs.meta
  17. 2
      com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodySensorTests.cs.meta
  18. 2
      com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodySensorTests.cs
  19. 7
      com.unity.ml-agents/Tests/Runtime/Sensor/CameraSensorTest.cs
  20. 48
      com.unity.ml-agents/Tests/Runtime/Sensor/StackingSensorTests.cs
  21. 3
      com.unity.ml-agents.extensions/Tests/Runtime/Sensors.meta
  22. 8
      com.unity.ml-agents/Tests/Runtime/Sensor.meta
  23. 3
      com.unity.ml-agents/Tests/Runtime/Utils.meta
  24. 3
      com.unity.ml-agents.extensions/Tests/Runtime/Sensors/AssemblyInfo.cs
  25. 3
      com.unity.ml-agents.extensions/Tests/Runtime/Sensors/AssemblyInfo.cs.meta
  26. 170
      com.unity.ml-agents/Tests/Runtime/Utils/TestClasses.cs
  27. 3
      com.unity.ml-agents/Tests/Runtime/Utils/TestClasses.cs.meta
  28. 24
      com.unity.ml-agents/Tests/Runtime/Utils/Unity.ML-Agents.Runtime.Utils.Tests.asmdef
  29. 3
      com.unity.ml-agents/Tests/Runtime/Utils/Unity.ML-Agents.Runtime.Utils.Tests.asmdef.meta
  30. 25
      com.unity.ml-agents/Tests/Runtime/Sensor/Unity.ML-Agents.Runtime.Sensor.Tests.asmdef
  31. 3
      com.unity.ml-agents/Tests/Runtime/Sensor/Unity.ML-Agents.Runtime.Sensor.Tests.asmdef.meta
  32. 8
      com.unity.ml-agents/Tests/Editor/Sensor.meta
  33. 0
      /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/PoseExtractorTests.cs.meta
  34. 0
      /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodyPoseExtractorTests.cs.meta
  35. 0
      /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/ArticulationBodyPoseExtractorTests.cs.meta
  36. 0
      /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/ArticulationBodySensorTests.cs.meta
  37. 0
      /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodySensorTests.cs.meta
  38. 0
      /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/ArticulationBodyPoseExtractorTests.cs
  39. 0
      /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/ArticulationBodySensorTests.cs
  40. 0
      /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/PoseExtractorTests.cs
  41. 0
      /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodyPoseExtractorTests.cs
  42. 0
      /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodySensorTests.cs
  43. 0
      /com.unity.ml-agents/Tests/Runtime/Sensor

1
com.unity.ml-agents.extensions/Runtime/AssemblyInfo.cs


[assembly: InternalsVisibleTo("Unity.ML-Agents.Extensions.EditorTests")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Extensions.Editor")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Extensions.Tests")]

1
com.unity.ml-agents.extensions/Tests/Editor/Unity.ML-Agents.Extensions.EditorTests.asmdef


"references": [
"Unity.ML-Agents.Extensions.Editor",
"Unity.ML-Agents.Extensions.TestUtils",
"Unity.ML-Agents.Extensions.Tests",
"Unity.ML-Agents.Extensions",
"Unity.ML-Agents"
],

3
com.unity.ml-agents.extensions/Tests/Runtime/Unity.ML-Agents.Extensions.Tests.asmdef


{
"name": "Unity.ML-Agents.Extensions.Tests",
"references": [
"Unity.ML-Agents.Extensions"
"Unity.ML-Agents.Extensions",
"Unity.ML-Agents"
],
"optionalUnityReferences": [
"TestAssemblies"

5
com.unity.ml-agents/Runtime/AssemblyInfo.cs


using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Unity.ML-Agents.Editor.Tests")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Runtime.Sensor.Tests")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Runtime.Utils.Tests")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Runtime.Tests")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Extensions.Tests")]

1
com.unity.ml-agents/Runtime/Communicator/GrpcExtensions.cs


[assembly: InternalsVisibleTo("Unity.ML-Agents.Editor")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Editor.Tests")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Runtime.Utils.Tests")]
namespace Unity.MLAgents
{

2
com.unity.ml-agents/Runtime/Grpc/AssemblyInfo.cs


[assembly: InternalsVisibleTo("Unity.ML-Agents")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Editor")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Editor.Tests")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Runtime.Sensor.Tests")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Runtime.Utils.Tests")]

3
com.unity.ml-agents/Runtime/Sensors/StackingSensor.cs


using UnityEngine;
using Unity.Barracuda;
[assembly: InternalsVisibleTo("Unity.ML-Agents.Editor.Tests")]
namespace Unity.MLAgents.Sensors
{
/// <summary>

1
com.unity.ml-agents/Tests/Editor/DemonstrationTests.cs


using Unity.MLAgents.Sensors;
using Unity.MLAgents.Demonstrations;
using Unity.MLAgents.Policies;
using Unity.MLAgents.Utils.Tests;
namespace Unity.MLAgents.Tests
{

1
com.unity.ml-agents/Tests/Editor/Inference/EditModeTestInternalBrainTensorGenerator.cs


using Unity.MLAgents.Inference;
using Unity.MLAgents.Policies;
using Unity.MLAgents.Sensors.Reflection;
using Unity.MLAgents.Utils.Tests;
namespace Unity.MLAgents.Tests
{

192
com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs


using UnityEngine;
using NUnit.Framework;
using System.Reflection;
using System.Collections.Generic;
using Unity.MLAgents.Utils.Tests;
internal class TestPolicy : IPolicy
{
public Action OnRequestDecision;
ObservationWriter m_ObsWriter = new ObservationWriter();
static ActionSpec s_ActionSpec = ActionSpec.MakeContinuous(1);
static ActionBuffers s_EmptyActionBuffers = new ActionBuffers(new float[1], Array.Empty<int>());
public void RequestDecision(AgentInfo info, List<ISensor> sensors)
{
foreach (var sensor in sensors)
{
sensor.GetObservationProto(m_ObsWriter);
}
OnRequestDecision?.Invoke();
}
public ref readonly ActionBuffers DecideAction() { return ref s_EmptyActionBuffers; }
public void Dispose() { }
}
public class TestAgent : Agent
{
internal AgentInfo _Info
{
get
{
return (AgentInfo)typeof(Agent).GetField("m_Info", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this);
}
set
{
typeof(Agent).GetField("m_Info", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(this, value);
}
}
internal void SetPolicy(IPolicy policy)
{
typeof(Agent).GetField("m_Brain", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(this, policy);
}
internal IPolicy GetPolicy()
{
return (IPolicy)typeof(Agent).GetField("m_Brain", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this);
}
public int initializeAgentCalls;
public int collectObservationsCalls;
public int collectObservationsCallsForEpisode;
public int agentActionCalls;
public int agentActionCallsForEpisode;
public int agentOnEpisodeBeginCalls;
public int heuristicCalls;
public TestSensor sensor1;
public TestSensor sensor2;
[Observable("observableFloat")]
public float observableFloat;
public override void Initialize()
{
initializeAgentCalls += 1;
// Add in some custom Sensors so we can confirm they get sorted as expected.
sensor1 = new TestSensor("testsensor1");
sensor2 = new TestSensor("testsensor2");
sensor2.compressionType = SensorCompressionType.PNG;
sensors.Add(sensor2);
sensors.Add(sensor1);
}
public override void CollectObservations(VectorSensor sensor)
{
collectObservationsCalls += 1;
collectObservationsCallsForEpisode += 1;
sensor.AddObservation(collectObservationsCallsForEpisode);
}
public override void OnActionReceived(ActionBuffers buffers)
{
agentActionCalls += 1;
agentActionCallsForEpisode += 1;
AddReward(0.1f);
}
public override void OnEpisodeBegin()
{
agentOnEpisodeBeginCalls += 1;
collectObservationsCallsForEpisode = 0;
agentActionCallsForEpisode = 0;
}
public override void Heuristic(in ActionBuffers actionsOut)
{
var obs = GetObservations();
var continuousActions = actionsOut.ContinuousActions;
continuousActions[0] = (int)obs[0];
heuristicCalls++;
}
}
public class TestSensor : ISensor
{
public string sensorName;
public int numWriteCalls;
public int numCompressedCalls;
public int numResetCalls;
public SensorCompressionType compressionType = SensorCompressionType.None;
public TestSensor(string n)
{
sensorName = n;
}
public ObservationSpec GetObservationSpec()
{
return ObservationSpec.Vector(0);
}
public int Write(ObservationWriter writer)
{
numWriteCalls++;
// No-op
return 0;
}
public byte[] GetCompressedObservation()
{
numCompressedCalls++;
return new byte[] { 0 };
}
public SensorCompressionType GetCompressionType()
{
return compressionType;
}
public string GetName()
{
return sensorName;
}
public void Update() { }
public void Reset()
{
numResetCalls++;
}
}
[TestFixture]
public class EditModeTestGeneration
{

Assert.AreEqual(stepsSinceReset, aca.StepCount);
Assert.AreEqual(numberReset, aca.EpisodeCount);
Assert.AreEqual(i, aca.TotalStepCount);
// Academy resets at the first step
if (i == 0)
{

numberAcaReset += 1;
numberAgent2Episodes += 1;
}
//Agent 1 is only initialized at step 2
if (i == 2)
{

Assert.AreEqual(numberAgent1Episodes, agent1.agentOnEpisodeBeginCalls);
}
// Set agent 1 to done every 11 steps to test behavior
if (i % 11 == 5)
{

Assert.AreEqual(numberAgent1Episodes, agent1.agentOnEpisodeBeginCalls);
}
// Ending the episode for agent 2 regularly
if (i % 13 == 3)
{

agent2StepForEpisode = 0;
Assert.AreEqual(numberAgent2Episodes, agent2.agentOnEpisodeBeginCalls);
}
// Request a decision for agent 2 regularly
if (i % 3 == 2)
{

agent2StepForEpisode += 1;
aca.EnvironmentStep();
}
}
[Test]
public void AssertStackingReset()
{
var agentGo1 = new GameObject("TestAgent");
var bp1 = agentGo1.AddComponent<BehaviorParameters>();
bp1.BrainParameters.ActionSpec = ActionSpec.MakeContinuous(1);
var agent1 = agentGo1.AddComponent<TestAgent>();
var behaviorParameters = agentGo1.GetComponent<BehaviorParameters>();
behaviorParameters.BrainParameters.NumStackedVectorObservations = 3;
var aca = Academy.Instance;
agent1.LazyInitialize();
var policy = new TestPolicy();
agent1.SetPolicy(policy);
StackingSensor sensor = null;
foreach (ISensor s in agent1.sensors)
{
if (s is StackingSensor)
{
sensor = s as StackingSensor;
}
}
Assert.NotNull(sensor);
for (int i = 0; i < 20; i++)
{
agent1.RequestDecision();
aca.EnvironmentStep();
}
policy.OnRequestDecision = () => SensorTestHelper.CompareObservation(sensor, new[] { 18f, 19f, 21f });
agent1.EndEpisode();
SensorTestHelper.CompareObservation(sensor, new[] { 0f, 0f, 0f });
}
}

3
com.unity.ml-agents/Tests/Editor/Unity.ML-Agents.Editor.Tests.asmdef


"Unity.ML-Agents.Editor",
"Unity.ML-Agents",
"Unity.Barracuda",
"Unity.ML-Agents.CommunicatorObjects"
"Unity.ML-Agents.CommunicatorObjects",
"Unity.ML-Agents.Runtime.Utils.Tests"
],
"optionalUnityReferences": [
"TestAssemblies"

2
com.unity.ml-agents/Tests/Runtime/Unity.ML-Agents.Runtime.Tests.asmdef


{
"name": "Tests",
"name": "Unity.ML-Agents.Runtime.Tests",
"references": [
"Unity.ML-Agents",
"Unity.Barracuda",

2
com.unity.ml-agents.extensions/Tests/Runtime/Sensors/PoseExtractorTests.cs.meta


fileFormatVersion: 2
guid: 9b0deb29b2f5d4b03a7f75a516943c81
guid: e228666ae564440a3afb6fb5afddd921
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodyPoseExtractorTests.cs.meta


fileFormatVersion: 2
guid: 23f57b248aaf940a3962cef68c6d83f5
guid: f83546d14c62641b9a2d88f066d120c7
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
com.unity.ml-agents.extensions/Tests/Runtime/Sensors/ArticulationBodyPoseExtractorTests.cs.meta


fileFormatVersion: 2
guid: 934ea08cde59d4356bc41e040d333c3d
guid: e8d41ed0d5b594ef0813fa0935e20b7e
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
com.unity.ml-agents.extensions/Tests/Runtime/Sensors/ArticulationBodySensorTests.cs.meta


fileFormatVersion: 2
guid: 0ef757469348342418a68826f51d0783
guid: bef5eb8df11b549c6a25d698a47ff428
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodySensorTests.cs.meta


fileFormatVersion: 2
guid: d8daf5517a7c94bfd9ac7f45f8d1bcd3
guid: 8b8b560acc80a4ddab0239d0535d5324
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodySensorTests.cs


using System.Runtime.CompilerServices;
namespace Unity.MLAgents.Extensions.Tests.Sensors
{

7
com.unity.ml-agents/Tests/Runtime/Sensor/CameraSensorTest.cs


using NUnit.Framework;
using UnityEngine;
using Unity.MLAgents.Sensors;
using Object = System.Object;
namespace Unity.MLAgents.Tests
{

var width = 24;
var height = 16;
var camera = Camera.main;
var c = new GameObject();
if (ReferenceEquals(null, camera))
{
camera = c.AddComponent<Camera>();
}
var sensor = new CameraSensor(camera, width, height, grayscale, "TestCameraSensor", compression);
var obsWriter = new ObservationWriter();

var expectedShape = new[] { height, width, grayscale ? 1 : 3 };
Assert.AreEqual(expectedShape, obs.Shape);
UnityEngine.Object.DestroyImmediate(c);
}
}
}

48
com.unity.ml-agents/Tests/Runtime/Sensor/StackingSensorTests.cs


using NUnit.Framework;
using System;
using System.Linq;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Policies;
using Unity.MLAgents.Utils.Tests;
[SetUp]
public void SetUp()
{
if (Academy.IsInitialized)
{
Academy.Instance.Dispose();
}
Academy.Instance.AutomaticSteppingEnabled = false;
}
[Test]
public void TestCtor()
{

Assert.AreEqual(sensor.GetObservationSpec().Shape, new InplaceArray<int>(16));
}
[Test]
public void AssertStackingReset()
{
var agentGo1 = new GameObject("TestAgent");
var bp1 = agentGo1.AddComponent<BehaviorParameters>();
bp1.BrainParameters.NumStackedVectorObservations = 3;
bp1.BrainParameters.ActionSpec = ActionSpec.MakeContinuous(1);
var aca = Academy.Instance;
var agent1 = agentGo1.AddComponent<TestAgent>();
var policy = new TestPolicy();
agent1.SetPolicy(policy);
StackingSensor sensor = null;
foreach (ISensor s in agent1.sensors)
{
if (s is StackingSensor)
{
sensor = s as StackingSensor;
}
}
Assert.NotNull(sensor);
for (int i = 0; i < 20; i++)
{
agent1.RequestDecision();
aca.EnvironmentStep();
}
policy.OnRequestDecision = () => SensorTestHelper.CompareObservation(sensor, new[] { 18f, 19f, 21f });
agent1.EndEpisode();
SensorTestHelper.CompareObservation(sensor, new[] { 0f, 0f, 0f });
}
[Test]

3
com.unity.ml-agents.extensions/Tests/Runtime/Sensors.meta


fileFormatVersion: 2
guid: 88803e617d2d429aa4838bdaaeb64bac
timeCreated: 1616140923

8
com.unity.ml-agents/Tests/Runtime/Sensor.meta


fileFormatVersion: 2
guid: 782dd744bcb0744b8a880aa70c8c7421
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

3
com.unity.ml-agents/Tests/Runtime/Utils.meta


fileFormatVersion: 2
guid: e4c1564ff83a4d51855e5b5b461f6a59
timeCreated: 1616137685

3
com.unity.ml-agents.extensions/Tests/Runtime/Sensors/AssemblyInfo.cs


using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Unity.ML-Agents.Extensions.EditorTests")]

3
com.unity.ml-agents.extensions/Tests/Runtime/Sensors/AssemblyInfo.cs.meta


fileFormatVersion: 2
guid: 60e8a1df689a49cc9f7dca42c93a8100
timeCreated: 1616141554

170
com.unity.ml-agents/Tests/Runtime/Utils/TestClasses.cs


using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Policies;
using Unity.MLAgents.Sensors;
using Unity.MLAgents.Sensors.Reflection;
[assembly: InternalsVisibleTo("Unity.ML-Agents.Editor.Tests")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Runtime.Sensor.Tests")]
[assembly: InternalsVisibleTo("Unity.ML-Agents.Extensions.EditorTests")]
namespace Unity.MLAgents.Utils.Tests
{
internal class TestPolicy : IPolicy
{
public Action OnRequestDecision;
ObservationWriter m_ObsWriter = new ObservationWriter();
static ActionSpec s_ActionSpec = ActionSpec.MakeContinuous(1);
static ActionBuffers s_EmptyActionBuffers = new ActionBuffers(new float[1], Array.Empty<int>());
public void RequestDecision(AgentInfo info, List<ISensor> sensors)
{
foreach (var sensor in sensors)
{
sensor.GetObservationProto(m_ObsWriter);
}
OnRequestDecision?.Invoke();
}
public ref readonly ActionBuffers DecideAction() { return ref s_EmptyActionBuffers; }
public void Dispose() { }
}
public class TestAgent : Agent
{
internal AgentInfo _Info
{
get
{
return (AgentInfo)typeof(Agent).GetField("m_Info", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this);
}
set
{
typeof(Agent).GetField("m_Info", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(this, value);
}
}
internal void SetPolicy(IPolicy policy)
{
typeof(Agent).GetField("m_Brain", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(this, policy);
}
internal IPolicy GetPolicy()
{
return (IPolicy)typeof(Agent).GetField("m_Brain", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this);
}
public int initializeAgentCalls;
public int collectObservationsCalls;
public int collectObservationsCallsForEpisode;
public int agentActionCalls;
public int agentActionCallsForEpisode;
public int agentOnEpisodeBeginCalls;
public int heuristicCalls;
public TestSensor sensor1;
public TestSensor sensor2;
[Observable("observableFloat")]
public float observableFloat;
public override void Initialize()
{
initializeAgentCalls += 1;
// Add in some custom Sensors so we can confirm they get sorted as expected.
sensor1 = new TestSensor("testsensor1");
sensor2 = new TestSensor("testsensor2");
sensor2.compressionType = SensorCompressionType.PNG;
sensors.Add(sensor2);
sensors.Add(sensor1);
}
public override void CollectObservations(VectorSensor sensor)
{
collectObservationsCalls += 1;
collectObservationsCallsForEpisode += 1;
sensor.AddObservation(collectObservationsCallsForEpisode);
}
public override void OnActionReceived(ActionBuffers buffers)
{
agentActionCalls += 1;
agentActionCallsForEpisode += 1;
AddReward(0.1f);
}
public override void OnEpisodeBegin()
{
agentOnEpisodeBeginCalls += 1;
collectObservationsCallsForEpisode = 0;
agentActionCallsForEpisode = 0;
}
public override void Heuristic(in ActionBuffers actionsOut)
{
var obs = GetObservations();
var continuousActions = actionsOut.ContinuousActions;
continuousActions[0] = (int)obs[0];
heuristicCalls++;
}
}
public class TestSensor : ISensor
{
public string sensorName;
public int numWriteCalls;
public int numCompressedCalls;
public int numResetCalls;
public SensorCompressionType compressionType = SensorCompressionType.None;
public TestSensor(string n)
{
sensorName = n;
}
public ObservationSpec GetObservationSpec()
{
return ObservationSpec.Vector(0);
}
public int Write(ObservationWriter writer)
{
numWriteCalls++;
// No-op
return 0;
}
public byte[] GetCompressedObservation()
{
numCompressedCalls++;
return new byte[] { 0 };
}
public SensorCompressionType GetCompressionType()
{
return compressionType;
}
public string GetName()
{
return sensorName;
}
public void Update() { }
public void Reset()
{
numResetCalls++;
}
}
public class TestClasses
{
}
}

3
com.unity.ml-agents/Tests/Runtime/Utils/TestClasses.cs.meta


fileFormatVersion: 2
guid: 329ca71a721948a9a64a7b3b48604058
timeCreated: 1616137640

24
com.unity.ml-agents/Tests/Runtime/Utils/Unity.ML-Agents.Runtime.Utils.Tests.asmdef


{
"name": "Unity.ML-Agents.Runtime.Utils.Tests",
"references": [
"Unity.ML-Agents",
"Unity.Barracuda",
"Unity.ML-Agents.CommunicatorObjects"
],
"optionalUnityReferences": [
"TestAssemblies"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"System.IO.Abstractions.dll",
"System.IO.Abstractions.TestingHelpers.dll",
"Google.Protobuf.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
]
}

3
com.unity.ml-agents/Tests/Runtime/Utils/Unity.ML-Agents.Runtime.Utils.Tests.asmdef.meta


fileFormatVersion: 2
guid: daaa01096d9848a38185ee08fa7321c0
timeCreated: 1616137694

25
com.unity.ml-agents/Tests/Runtime/Sensor/Unity.ML-Agents.Runtime.Sensor.Tests.asmdef


{
"name": "Unity.ML-Agents.Runtime.Sensor.Tests",
"references": [
"Unity.ML-Agents",
"Unity.Barracuda",
"Unity.ML-Agents.CommunicatorObjects",
"Unity.ML-Agents.Runtime.Utils.Tests"
],
"optionalUnityReferences": [
"TestAssemblies"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"System.IO.Abstractions.dll",
"System.IO.Abstractions.TestingHelpers.dll",
"Google.Protobuf.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
]
}

3
com.unity.ml-agents/Tests/Runtime/Sensor/Unity.ML-Agents.Runtime.Sensor.Tests.asmdef.meta


fileFormatVersion: 2
guid: 917f332e7ad944428f0246683188de8f
timeCreated: 1616137285

8
com.unity.ml-agents/Tests/Editor/Sensor.meta


fileFormatVersion: 2
guid: 1b196836e6e3a4361bc62265ec88ebed
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

/com.unity.ml-agents.extensions/Tests/Editor/Sensors/PoseExtractorTests.cs.meta → /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/PoseExtractorTests.cs.meta

/com.unity.ml-agents.extensions/Tests/Editor/Sensors/RigidBodyPoseExtractorTests.cs.meta → /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodyPoseExtractorTests.cs.meta

/com.unity.ml-agents.extensions/Tests/Editor/Sensors/ArticulationBodyPoseExtractorTests.cs.meta → /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/ArticulationBodyPoseExtractorTests.cs.meta

/com.unity.ml-agents.extensions/Tests/Editor/Sensors/ArticulationBodySensorTests.cs.meta → /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/ArticulationBodySensorTests.cs.meta

/com.unity.ml-agents.extensions/Tests/Editor/Sensors/RigidBodySensorTests.cs.meta → /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodySensorTests.cs.meta

/com.unity.ml-agents.extensions/Tests/Editor/Sensors/ArticulationBodyPoseExtractorTests.cs → /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/ArticulationBodyPoseExtractorTests.cs

/com.unity.ml-agents.extensions/Tests/Editor/Sensors/ArticulationBodySensorTests.cs → /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/ArticulationBodySensorTests.cs

/com.unity.ml-agents.extensions/Tests/Editor/Sensors/PoseExtractorTests.cs → /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/PoseExtractorTests.cs

/com.unity.ml-agents.extensions/Tests/Editor/Sensors/RigidBodyPoseExtractorTests.cs → /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodyPoseExtractorTests.cs

/com.unity.ml-agents.extensions/Tests/Editor/Sensors/RigidBodySensorTests.cs → /com.unity.ml-agents.extensions/Tests/Runtime/Sensors/RigidBodySensorTests.cs

/com.unity.ml-agents/Tests/Editor/Sensor → /com.unity.ml-agents/Tests/Runtime/Sensor

正在加载...
取消
保存