Added a batch mode for network training