### Question:
NeuralNetwork { public LayerParameter[] generateParameterGradients(final Matrix[] activations, final Matrix[] errors) { return generateParameterGradients(0, layers.length - 1, activations, errors); } @Inject private  NeuralNetwork(final MatrixFactory matrixFactory,
                        final ConfigurationSerializer configurationSerializer,
                        @Parameter(SerializedLayerConfigurationSet.class) final Set<String> serializedLayerConfSets,
                        final ParameterProvider parameterProvider,
                        @Parameter(InputShape.class) final String inputShape,
                        final Injector injector); LayerParameter[] getParameters(); void train(final Matrix input, final Matrix label); void train(final Matrix input, final int[] labels); Matrix[] feedForward(final Matrix input); Matrix[] feedForward(final int begin, final int end, final Matrix input); Matrix[] backPropagate(final Matrix[] activations,
                                final Matrix label); Matrix[] backPropagateTo(final int end,
                                  final Matrix[] activations,
                                  final Matrix label); Matrix[] backPropagateFromTo(final int begin, final int end,
                                      final Matrix[] activations,
                                      final Matrix nextError); LayerParameter[] generateParameterGradients(final Matrix[] activations,
                                                     final Matrix[] errors); LayerParameter[] generateParameterGradients(final int begin, final int end,
                                                     final Matrix[] activations,
                                                     final Matrix[] errors);  }### Answer:
@Test public void localNeuralNetParameterProviderTest() throws InjectionException { final Matrix[] activations = ArrayUtils.add(expectedActivations, 0, input); final LocalNeuralNetParameterProvider localNeuralNetParameterProvider = Tang.Factory.getTang() .newInjector(blasConfiguration, neuralNetworkConfiguration).getInstance(LocalNeuralNetParameterProvider.class); localNeuralNetParameterProvider.push(input.getColumns(), neuralNetwork.generateParameterGradients(activations, expectedErrors)); assertTrue(compare(expectedParams, localNeuralNetParameterProvider.pull(), TOLERANCE)); }
@Test public void localNeuralNetParameterProviderBatchTest() throws InjectionException { final Matrix[] batchActivations = ArrayUtils.add(expectedBatchActivations, 0, batchInput); final LocalNeuralNetParameterProvider localNeuralNetParameterProvider = Tang.Factory.getTang() .newInjector(blasConfiguration, neuralNetworkConfiguration).getInstance(LocalNeuralNetParameterProvider.class); localNeuralNetParameterProvider.push(batchInput.getColumns(), neuralNetwork.generateParameterGradients(batchActivations, expectedBatchErrors)); assertTrue(compare(expectedBatchParams, localNeuralNetParameterProvider.pull(), TOLERANCE)); }