|
|
|
|
|
|
m_Allocator = allocator; |
|
|
|
} |
|
|
|
|
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IEnumerable<AgentInfoSensorsPair> infos) |
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSensorsPair> infos) |
|
|
|
{ |
|
|
|
TensorUtils.ResizeTensor(tensorProxy, batchSize, m_Allocator); |
|
|
|
} |
|
|
|
|
|
|
m_Allocator = allocator; |
|
|
|
} |
|
|
|
|
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IEnumerable<AgentInfoSensorsPair> infos) |
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSensorsPair> infos) |
|
|
|
{ |
|
|
|
tensorProxy.data?.Dispose(); |
|
|
|
tensorProxy.data = m_Allocator.Alloc(new TensorShape(1, 1)); |
|
|
|
|
|
|
m_Allocator = allocator; |
|
|
|
} |
|
|
|
|
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IEnumerable<AgentInfoSensorsPair> infos) |
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSensorsPair> infos) |
|
|
|
{ |
|
|
|
tensorProxy.shape = new long[0]; |
|
|
|
tensorProxy.data?.Dispose(); |
|
|
|
|
|
|
m_SensorIndices.Add(sensorIndex); |
|
|
|
} |
|
|
|
|
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IEnumerable<AgentInfoSensorsPair> infos) |
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSensorsPair> infos) |
|
|
|
foreach (var info in infos) |
|
|
|
for (var infoIndex = 0; infoIndex < infos.Count; infoIndex++) |
|
|
|
var info = infos[infoIndex]; |
|
|
|
if (info.agentInfo.done) |
|
|
|
{ |
|
|
|
// If the agent is done, we might have a stale reference to the sensors
|
|
|
|
|
|
|
{ |
|
|
|
var tensorOffset = 0; |
|
|
|
// Write each sensor consecutively to the tensor
|
|
|
|
foreach (var sensorIndex in m_SensorIndices) |
|
|
|
// TOOD
|
|
|
|
for (var sensorIndexIndex = 0; sensorIndexIndex < m_SensorIndices.Count; sensorIndexIndex++) |
|
|
|
var sensorIndex = m_SensorIndices[sensorIndexIndex]; |
|
|
|
var sensor = info.sensors[sensorIndex]; |
|
|
|
m_ObservationWriter.SetTarget(tensorProxy, agentIndex, tensorOffset); |
|
|
|
var numWritten = sensor.Write(m_ObservationWriter); |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void Generate( |
|
|
|
TensorProxy tensorProxy, int batchSize, IEnumerable<AgentInfoSensorsPair> infos) |
|
|
|
TensorProxy tensorProxy, int batchSize, IList<AgentInfoSensorsPair> infos) |
|
|
|
foreach (var infoSensorPair in infos) |
|
|
|
for (var infoIndex = 0; infoIndex < infos.Count; infoIndex++) |
|
|
|
var infoSensorPair = infos[infoIndex]; |
|
|
|
var info = infoSensorPair.agentInfo; |
|
|
|
List<float> memory; |
|
|
|
|
|
|
|
|
|
|
m_Memories = memories; |
|
|
|
} |
|
|
|
|
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IEnumerable<AgentInfoSensorsPair> infos) |
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSensorsPair> infos) |
|
|
|
foreach (var infoSensorPair in infos) |
|
|
|
for (var infoIndex = 0; infoIndex < infos.Count; infoIndex++) |
|
|
|
var infoSensorPair = infos[infoIndex]; |
|
|
|
|
|
|
|
var info = infoSensorPair.agentInfo; |
|
|
|
var offset = memorySize * m_MemoryIndex; |
|
|
|
List<float> memory; |
|
|
|
|
|
|
m_Allocator = allocator; |
|
|
|
} |
|
|
|
|
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IEnumerable<AgentInfoSensorsPair> infos) |
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSensorsPair> infos) |
|
|
|
foreach (var infoSensorPair in infos) |
|
|
|
for (var infoIndex = 0; infoIndex < infos.Count; infoIndex++) |
|
|
|
var infoSensorPair = infos[infoIndex]; |
|
|
|
|
|
|
|
var info = infoSensorPair.agentInfo; |
|
|
|
var pastAction = info.storedVectorActions; |
|
|
|
if (pastAction != null) |
|
|
|
|
|
|
m_Allocator = allocator; |
|
|
|
} |
|
|
|
|
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IEnumerable<AgentInfoSensorsPair> infos) |
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSensorsPair> infos) |
|
|
|
foreach (var infoSensorPair in infos) |
|
|
|
for (var infoIndex = 0; infoIndex < infos.Count; infoIndex++) |
|
|
|
var infoSensorPair = infos[infoIndex]; |
|
|
|
|
|
|
|
var agentInfo = infoSensorPair.agentInfo; |
|
|
|
var maskList = agentInfo.discreteActionMasks; |
|
|
|
for (var j = 0; j < maskSize; j++) |
|
|
|
|
|
|
m_Allocator = allocator; |
|
|
|
} |
|
|
|
|
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IEnumerable<AgentInfoSensorsPair> infos) |
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSensorsPair> infos) |
|
|
|
{ |
|
|
|
TensorUtils.ResizeTensor(tensorProxy, batchSize, m_Allocator); |
|
|
|
TensorUtils.FillTensorWithRandomNormal(tensorProxy, m_RandomNormal); |
|
|
|
|
|
|
m_Allocator = allocator; |
|
|
|
} |
|
|
|
|
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IEnumerable<AgentInfoSensorsPair> infos) |
|
|
|
public void Generate(TensorProxy tensorProxy, int batchSize, IList<AgentInfoSensorsPair> infos) |
|
|
|
foreach (var infoSensorPair in infos) |
|
|
|
for (var infoIndex = 0; infoIndex < infos.Count; infoIndex++) |
|
|
|
var infoSensorPair = infos[infoIndex]; |
|
|
|
|
|
|
|
var sensor = infoSensorPair.sensors[m_SensorIndex]; |
|
|
|
if (infoSensorPair.agentInfo.done) |
|
|
|
{ |
|
|
|