Add back propagation

Add back propagation, remove "const" of all input array parameters,
since it would be annoying when updating weights