Studying deep learning framework in massive cellular system to optimize its performance is a challenge task. In this paper, multi-cell massive cellular system with device-to-device (D2D) communication is studied, where D2D pairs and cellular users can share different orthogonal pilots to overcome interference at the cellular base station (BS). We propose data and pilot power controls scheme based on deep learning framework using convolutional neural network (CNN) for cellular and D2D users. The main focus is to obtain the optimal data and pilot powers (i.e., cellular pilot power, p pilot Cellular User , cellular data power, p Cellular User , D2D pilot power, p pilot D2D , and D2D data power, p D2D ) for maximum spectral efficiency (SE). SE optimization problem is formulated with the goal of obtaining optimal transmit powers. Also, comparison between the proposed scheme and the iterative power control schemes (i.e., weighted minimum mean square error [MMSE] technique, bisection technique, and technique-based geometric mean per-cell max-min fairness) is provided.Results show that the proposed scheme can increase the sum SE of multi-cell massive cellular system with D2D communications.