Skip to content

Commit 566770f

Browse files
Checking if the Past action is null before feeding into inference (#3403)
1 parent 7757d06 commit 566770f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

com.unity.ml-agents/Runtime/InferenceBrain/GeneratorImpl.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,11 @@ public void Generate(TensorProxy tensorProxy, int batchSize, IEnumerable<AgentIn
269269
{
270270
var info = infoSensorPair.agentInfo;
271271
var pastAction = info.storedVectorActions;
272-
for (var j = 0; j < actionSize; j++)
273-
{
274-
tensorProxy.data[agentIndex, j] = pastAction[j];
272+
if (pastAction != null){
273+
for (var j = 0; j < actionSize; j++)
274+
{
275+
tensorProxy.data[agentIndex, j] = pastAction[j];
276+
}
275277
}
276278

277279
agentIndex++;

0 commit comments

Comments
 (0)