def METHOD_NAME(self, labels):
    # if self.cost_function == "cross_entropy" and self.layers[self.num_layers-1].activation_function == "softmax":
    targets = labels
    i = self.num_layers - 1
    y = self.layers[i].activations
    deltaw = np.matmul(
        np.asarray(self.layers[i - 1].activations).T,
        np.multiply(y, np.multiply(1 - y, targets - y)),
    )
    new_weights = self.layers[i - 1].weights_for_layer - self.learning_rate * deltaw
    for i in range(i - 1, 0, -1):
        y = self.layers[i].activations
        deltaw = np.matmul(
            np.asarray(self.layers[i - 1].activations).T,
            np.multiply(
                y,
                np.multiply(
                    1 - y,
                    np.sum(
                        np.multiply(new_weights, self.layers[i].weights_for_layer),
                        axis=1,
                    ).T,
                ),
            ),
        )
        self.layers[i].weights_for_layer = new_weights
        new_weights = (
            self.layers[i - 1].weights_for_layer - self.learning_rate * deltaw
        )
    self.layers[0].weights_for_layer = new_weights