4 hidden checks
Implement the backward rules for a dense layer and a ReLU. The hidden checks compare your gradients with numerical ones.
dense_backward(X, W, dY): for the forward passY = X @ W + b, return(dX, dW, db)given the upstream gradientdY.relu_backward(Z, dA): forA = relu(Z), returndZ.
- shapes match the forward passnot run
- dense gradients match numerical gradientsnot run
- relu_backward gates the gradientnot run
- a two-layer backward pass is correct end to endnot run