浏览代码

build fixes for 2018+ (#2808)

* rename CompressionType enum

* fix standalone build test for 2018+
/develop-gpu-test
GitHub 5 年前
当前提交
2431f184
共有 8 个文件被更改,包括 43 次插入23 次删除
  1. 4
      UnitySDK/Assets/ML-Agents/Editor/Tests/MLAgentsEditModeTest.cs
  2. 29
      UnitySDK/Assets/ML-Agents/Editor/Tests/StandaloneBuildTest.cs
  3. 12
      UnitySDK/Assets/ML-Agents/Scripts/Agent.cs
  4. 4
      UnitySDK/Assets/ML-Agents/Scripts/Sensor/CameraSensor.cs
  5. 3
      UnitySDK/Assets/ML-Agents/Scripts/Sensor/CompressedObservation.cs
  6. 6
      UnitySDK/Assets/ML-Agents/Scripts/Sensor/ISensor.cs
  7. 4
      UnitySDK/Assets/ML-Agents/Scripts/Sensor/RenderTextureSensor.cs
  8. 4
      UnitySDK/Assets/ML-Agents/Scripts/Sensor/SensorBase.cs

4
UnitySDK/Assets/ML-Agents/Editor/Tests/MLAgentsEditModeTest.cs


return null;
}
public CompressionType GetCompressionType()
public SensorCompressionType GetCompressionType()
return CompressionType.None;
return SensorCompressionType.None;
}
public string GetName()

29
UnitySDK/Assets/ML-Agents/Editor/Tests/StandaloneBuildTest.cs


using System;
using UnityEditor;
using UnityEngine;
#if UNITY_2018_1_OR_NEWER
using UnityEditor.Build.Reporting;
#endif
namespace MLAgents
{

{
string[] scenes = { "Assets/ML-Agents/Examples/3DBall/Scenes/3DBall.unity" };
var error = BuildPipeline.BuildPlayer(scenes, "testPlayer", BuildTarget.StandaloneOSX, BuildOptions.None);
if (string.IsNullOrEmpty(error))
var buildResult = BuildPipeline.BuildPlayer(scenes, "testPlayer", BuildTarget.StandaloneOSX, BuildOptions.None);
#if UNITY_2018_1_OR_NEWER
var isOK = buildResult.summary.result == BuildResult.Succeeded;
var error = "";
foreach (var stepInfo in buildResult.steps)
{
foreach (var msg in stepInfo.messages)
{
if (msg.type != LogType.Log && msg.type != LogType.Warning)
{
error += msg.content + "\n";
}
}
}
#else
var error = buildResult;
var isOK = string.IsNullOrEmpty(error);
#endif
if (isOK)
{
EditorApplication.Exit(0);
}

EditorApplication.Exit(1);
}
}

12
UnitySDK/Assets/ML-Agents/Scripts/Agent.cs


/// of the environment extracts its current observation, sends them to its
/// policy and in return receives an action. In practice,
/// however, an agent need not send its observation at every step since very
/// little may have changed between successive steps.
/// little may have changed between successive steps.
///
/// At any step, an agent may be considered <see cref="m_Done"/>.
/// This could occur due to a variety of reasons:

/// <summary>
/// Updates the Model for the agent. Any model currently assigned to the
/// agent will be replaced with the provided one. If the arguments are
/// agent will be replaced with the provided one. If the arguments are
/// remain unchanged.
/// remain unchanged.
/// <param name="behaviorName"> The identifier of the behavior. This
/// will categorize the agent when training.
/// <param name="behaviorName"> The identifier of the behavior. This
/// will categorize the agent when training.
/// <param name = "inferenceDevide"> Define on what device the model
/// <param name = "inferenceDevide"> Define on what device the model
/// will be run.</param>
public void GiveModel(
string behaviorName,

4
UnitySDK/Assets/ML-Agents/Scripts/Sensor/CameraSensor.cs


}
}
public CompressionType GetCompressionType()
public SensorCompressionType GetCompressionType()
return CompressionType.PNG;
return SensorCompressionType.PNG;
}
/// <summary>

3
UnitySDK/Assets/ML-Agents/Scripts/Sensor/CompressedObservation.cs


using System;
using MLAgents.InferenceBrain;
using UnityEngine;
namespace MLAgents.Sensor

/// <summary>
/// The format of the compressed data
/// </summary>
public CompressionType CompressionType;
public SensorCompressionType CompressionType;
/// <summary>
/// The uncompressed dimensions of the data.

6
UnitySDK/Assets/ML-Agents/Scripts/Sensor/ISensor.cs


namespace MLAgents.Sensor
{
public enum CompressionType
public enum SensorCompressionType
{
None,
PNG,

byte[] GetCompressedObservation();
/// <summary>
/// Return the compression type being used. If no compression is used, return CompressionType.None
/// Return the compression type being used. If no compression is used, return SensorCompressionType.None
CompressionType GetCompressionType();
SensorCompressionType GetCompressionType();
/// <summary>
/// Get the name of the sensor. This is used to ensure deterministic sorting of the sensors on an Agent,

4
UnitySDK/Assets/ML-Agents/Scripts/Sensor/RenderTextureSensor.cs


}
}
public CompressionType GetCompressionType()
public SensorCompressionType GetCompressionType()
return CompressionType.PNG;
return SensorCompressionType.PNG;
}
/// <summary>

4
UnitySDK/Assets/ML-Agents/Scripts/Sensor/SensorBase.cs


return null;
}
public virtual CompressionType GetCompressionType()
public virtual SensorCompressionType GetCompressionType()
return CompressionType.None;
return SensorCompressionType.None;
}
}
}
正在加载...
取消
保存