浏览代码

Address comments

/goal-conditioning/new
Arthur Juliani 4 年前
当前提交
2552cf18
共有 2 个文件被更改,包括 24 次插入12 次删除
  1. 21
      Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/VectorSensorComponent.cs
  2. 15
      ml-agents/mlagents/trainers/torch/networks.py

21
Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/VectorSensorComponent.cs


public class VectorSensorComponent : SensorComponent
{
public int observationSize;
int m_observationSize;
ObservationType m_ObservationType;
public int ObservationSize
{
get { return m_observationSize; }
set { m_observationSize = value; }
}
public ObservationType observationType;
public ObservationType ObservationType
{
get { return m_ObservationType; }
set { m_ObservationType = value; }
}
/// <summary>
/// Creates a VectorSensor.

{
sensor = new VectorSensor(observationSize, observationType: observationType);
sensor = new VectorSensor(m_observationSize, observationType: m_ObservationType);
return sensor;
}

return new[] { observationSize };
return new[] { m_observationSize };
}
}

15
ml-agents/mlagents/trainers/torch/networks.py


for idx, processor in enumerate(self.processors):
obs_input = inputs[idx]
processed_obs = processor(obs_input)
if (
self.obs_types[idx] == ObservationType.DEFAULT
or self.conditioning_type == ConditioningType.DEFAULT
):
if self.obs_types[idx] == ObservationType.DEFAULT:
elif (
self.obs_types[idx] == ObservationType.GOAL
and self.conditioning_type != ConditioningType.DEFAULT
):
elif self.obs_types[idx] == ObservationType.GOAL:
if self.conditioning_type == ConditioningType.DEFAULT:
obs_encodes = obs_encodes + goal_encodes
goal_encodes = []
if len(obs_encodes) == 0:
raise Exception("No valid inputs to network.")

正在加载...
取消
保存