浏览代码

[Semantics] Modified some fields of the CoreInternalBrain (#373)

/develop-generalizationTraining-TrainerController
GitHub 7 年前
当前提交
171e551b
共有 1 个文件被更改,包括 17 次插入17 次删除
  1. 34
      unity-environment/Assets/ML-Agents/Scripts/CoreBrainInternal.cs

34
unity-environment/Assets/ML-Agents/Scripts/CoreBrainInternal.cs


/// Modify only in inspector : Name of the placholder of the batch size
public string BatchSizePlaceholderName = "batch_size";
/// Modify only in inspector : Name of the state placeholder
public string StatePlacholderName = "state";
public string VectorObservationPlacholderName = "state";
public string[] ObservationPlaceholderName;
public string[] VisualObservationPlaceholderName;
/// Modify only in inspector : Name of the action node
public string ActionPlaceholderName = "action";
/// Modify only in inspector : Name of the previous action node

var networkOutput = runner.Run()[0].GetValue();
memorySize = (int)networkOutput;
}
if (graph[graphScope + StatePlacholderName] != null)
if (graph[graphScope + VectorObservationPlacholderName] != null)
{
hasState = brain.brainParameters.vectorActionSpaceType == StateType.discrete;
}

{
discreteInputState[i, 0] = (int)inputState[i, 0];
}
runner.AddInput(graph[graphScope + StatePlacholderName][0], discreteInputState);
runner.AddInput(graph[graphScope + VectorObservationPlacholderName][0], discreteInputState);
runner.AddInput(graph[graphScope + StatePlacholderName][0], inputState);
runner.AddInput(graph[graphScope + VectorObservationPlacholderName][0], inputState);
}
}

// Create the observation tensors
for (int obs_number = 0; obs_number < brain.brainParameters.cameraResolutions.Length; obs_number++)
{
runner.AddInput(graph[graphScope + ObservationPlaceholderName[obs_number]][0], observationMatrixList[obs_number]);
runner.AddInput(graph[graphScope + VisualObservationPlaceholderName[obs_number]][0], observationMatrixList[obs_number]);
}
if (hasRecurrent)

}
BatchSizePlaceholderName = EditorGUILayout.TextField(new GUIContent("Batch Size Node Name", "If the batch size is one of " +
"the inputs of your graph, you must specify the name if the placeholder here."), BatchSizePlaceholderName);
if (StatePlacholderName == "")
if (VectorObservationPlacholderName == "")
StatePlacholderName = "state";
VectorObservationPlacholderName = "state";
StatePlacholderName = EditorGUILayout.TextField(new GUIContent("State Node Name", "If your graph uses the state as an input, " +
"you must specify the name if the placeholder here."), StatePlacholderName);
VectorObservationPlacholderName = EditorGUILayout.TextField(new GUIContent("Vector Observation Node Name", "If your graph uses the state as an input, " +
"you must specify the name if the placeholder here."), VectorObservationPlacholderName);
if (RecurrentInPlaceholderName == "")
{
RecurrentInPlaceholderName = "recurrent_in";

{
if (brain.brainParameters.cameraResolutions.Count() > 0)
{
if (ObservationPlaceholderName == null)
if (VisualObservationPlaceholderName == null)
ObservationPlaceholderName = new string[brain.brainParameters.cameraResolutions.Count()];
VisualObservationPlaceholderName = new string[brain.brainParameters.cameraResolutions.Count()];
if (ObservationPlaceholderName.Count() != brain.brainParameters.cameraResolutions.Count())
if (VisualObservationPlaceholderName.Count() != brain.brainParameters.cameraResolutions.Count())
ObservationPlaceholderName = new string[brain.brainParameters.cameraResolutions.Count()];
VisualObservationPlaceholderName = new string[brain.brainParameters.cameraResolutions.Count()];
if ((ObservationPlaceholderName[obs_number] == "") || (ObservationPlaceholderName[obs_number] == null))
if ((VisualObservationPlaceholderName[obs_number] == "") || (VisualObservationPlaceholderName[obs_number] == null))
ObservationPlaceholderName[obs_number] = "visual_observation_" + obs_number;
VisualObservationPlaceholderName[obs_number] = "visual_observation_" + obs_number;
var opn = serializedBrain.FindProperty("ObservationPlaceholderName");
var opn = serializedBrain.FindProperty("VisualObservationPlaceholderName");
serializedBrain.Update();
EditorGUILayout.PropertyField(opn, true);
serializedBrain.ApplyModifiedProperties();

正在加载...
取消
保存