Memristive devices when organized in crossbar arrays can be used to accelerate the training of deep neural networks through in-memory computing. In this paper, we propose a scheme that addresses a key challenge, namely, the non-linear accumulative behavior of memristive devices. Data entering and leaving the memristive crossbar array is pre- A nd post-processed to change the effective mapping of weight matrices onto the conductance matrix. The impact of the proposed scheme is studied for training neural networks using phase-change memory (PCM) devices as synaptic elements. The scheme is shown to significantly improve the network's classification accuracy, allowing us to reach the performance of an ideal linear device.