Diffractive neural networks (DNNs) are an emerging design method for systems of cascaded phase masks, where the optical system is treated as an all-optical neural network. In previous work, we have demonstrated how this method can be used to design highly flexible beam shaping systems. We have also shown that DNNs can be used to correct pixel crosstalk and direct reflection in a spatial light modulator based on liquid crystal on silicon. Here, we extend the correction of these effects to two cascaded spatial light modulators and demonstrate the resulting increase in accuracy of the three-dimensional beam shaping capabilities of DNNs.