Training Deep Neural Networks with In-Memory Computing