Added autodiff wrapper for ANN components and loss functions