Role of synaptic stochasticity in training low-precision neural networks