Hardware architectures for machine learning training