public function backpropagate(array $labels) : float
    {
        [$gradient, $loss] = $this->output->back($labels, $this->optimizer);

        foreach ($this->backPass as $layer) {
            $gradient = $layer->back($gradient, $this->optimizer);
        }

        return $loss;
    }
public function backpropagate(array $labels) : float
    {
        [$gradient, $loss] = $this->output->back($labels, $this->optimizer);

        foreach ($this->backPass as $layer) {
            $gradient = $layer->back($gradient, $this->optimizer);
        }

        return $loss;
    }
public function backpropagate ( array $ labels ) : float { [ $ gradient , $ loss ] = $ this -> output -> back ( $ labels , $ this -> optimizer ) ; foreach ( $ this -> backPass as $ layer ) { $ gradient = $ layer -> back ( $ gradient , $ this -> optimizer ) ; } return $ loss ; }
Backpropagate the gradient produced by the cost function and return
the loss calculated by the output layer's cost function.

@param array $labels
@return float
Backpropagate the gradient produced by the cost function and return the loss calculated by the output layer s cost function .