Modularised training algorithm to allow testing of acceleration.