public BatchItem(BackpropAlgorithm alg) { m_Algorithm = alg; var net = alg.Net; m_Values = new double[net.LayerCount][][, ]; m_Errors = new double[net.LayerCount][][, ]; m_GradientPortion = new double[net.LayerCount][]; for (int l = 0; l < net.LayerCount; l++) { var layer = net[l]; m_GradientPortion[l] = new double[layer.ParamCount]; m_Values[l] = new double[layer.OutputDepth][, ]; m_Errors[l] = new double[layer.OutputDepth][, ]; for (int p = 0; p < layer.OutputDepth; p++) { m_Values[l][p] = new double[layer.OutputHeight, layer.OutputWidth]; m_Errors[l][p] = new double[layer.OutputHeight, layer.OutputWidth]; } } }
public BatchContext(BackpropAlgorithm alg, int maxDegreesOfParallelism) { m_Algorithm = alg; m_Threads = maxDegreesOfParallelism; m_Items = new BatchItem[maxDegreesOfParallelism]; }