def param_grad(self, x, y=None, acts=None):
        """
        Calculate the gradient of the cost function with respect to all learnable parameters of this
        network.
        
        Parameters
        ----------
        x : numpy array, training examples; shape should be (NUMBER_OF_EXAMPLES,) + self.input_shape
        y : numpy array, training labels, shape should be (NUMBER_OF_EXAMPLES, shape of labels)
        acts : (optional) list that contains a numpy array for each layer in the network; the first
            element in the list is the array x itself, and each following array is the output of
            that layer for the given examples x
        
        Returns
        -------
        param_grad : numpy array of length self.num_params()

        """
        if acts is None:
            acts = self.forward(x)

        curr_act_grad = self.cost_grad(final_acts=acts[-1], y=y)
        param_grad = []

        for ind_from_end, layer in enumerate(reversed(self.layers_)):
            curr_act_grad, curr_param_grad = layer.backward(curr_act_grad, acts[-2-ind_from_end])
            if curr_param_grad is not None:
                param_grad.append(curr_param_grad)

        param_grad.reverse()
        return np.concatenate(param_grad)
dataset/ETHPy150Open bbabenko/simple_convnet/simple_convnet/convnet.py/NNet.param_grad/original