Implementing only reverse mode AD