浏览代码

check tensor exist before access shape

/MLA-1734-demo-provider
Ruo-Ping Dong 4 年前
当前提交
1ab8871e
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 6
      com.unity.ml-agents/Runtime/Inference/BarracudaModelExtensions.cs

6
com.unity.ml-agents/Runtime/Inference/BarracudaModelExtensions.cs


}
else
{
return (int)model.GetTensorByName(TensorNames.ContinuousActionOutputShape)[0];
var continuousOutputShape = model.GetTensorByName(TensorNames.ContinuousActionOutputShape);
return continuousOutputShape == null ? 0 : (int)continuousOutputShape[0];
}
}

}
else
{
return (int)model.GetTensorByName(TensorNames.DiscreteActionOutputShape)[0];
var discreteOutputShape = model.GetTensorByName(TensorNames.DiscreteActionOutputShape);
return discreteOutputShape == null ? 0 : (int)discreteOutputShape[0];
}
}

正在加载...
取消
保存