code: function(y) {
        var N = this.layers.length;
        var loss = this.layers[N-1].backward(y); // last layer assumed to be loss layer
        for(var i=N-2;i>=0;i--) { // first layer assumed input
          this.layers[i].backward();
        }
        return loss;
      }
docs: backprop: compute gradients wrt all parameters