Apple Interview Question

Implement the forward and backward pass of a custom function to enable back-propagation.