Low Precision Inference and Training for Deep Neural Networks