We get our next batch of data in an enumerable fashion. We first verify parameters, and then call the CreateBatch() function, which is listed after this function:
private static IEnumerable<(float[] X, float[] Y)> GetNextDataBatch(float[][] X, float[][] Y, int mMSize)
{
if (X == null)
throw new ArgumentException("X parameter cannot be null");
if (Y == null)
throw new ArgumentException("Y parameter cannot be null");
for (int i = 0; i <= X.Length - 1; i += mMSize)
{
var size = X.Length - i;
if (size > 0 && size > mMSize)
size = mMSize;
var x = CreateBatch(X, i, size);
var y = CreateBatch(Y, i, size);
yield return (x, y);
}
}