// Tries to process a random batch through the network (this method should just not crash) private static void ValidateGraph([NotNull] INeuralNetwork network) { float[,] x = new float[200, network.InputInfo.Size], y = new float[200, network.OutputInfo.Size]; for (int i = 0; i < 200; i++) { for (int j = 0; j < x.GetLength(1); j++) { x[i, j] = ThreadSafeRandom.NextFloat(); } y[i, ThreadSafeRandom.NextInt(max: y.GetLength(1))] = 1; } _ = network.Forward(x); SamplesBatch batch = new SamplesBatch(x, y); ComputationGraphNetwork graph = network.To <INeuralNetwork, ComputationGraphNetwork>(); graph.Backpropagate(batch, 0.5f, WeightsUpdaters.AdaDelta(TrainingAlgorithms.AdaDelta(), graph)); _ = network.ExtractDeepFeatures(x); }