Fix backpropagation implementation

Backpropagation now correctly implemented and expand the TrainerIO
interface to provide the number of inputs and ouputs of the network.