Over the last few decades, artificial neural networks (ANN) have played an important role in many areas of human activity and have found application in many branches of natural sciences. ANNs have been widely used to tackle problems related to linear and nonlinear differential equations, and numerous paradigms for ANN architecture have been employed. Based on ANN and the Taylor series, this research proposes a computational technique to solve difficulties connected to the Tolman-Oppenheimer-Volkoff equations (TOV) of the relativistic gas spheres. We used ANN to study two cases related to relativistic polytropes. The first is to simulate both the Emden and the relativistic functions, and the second is to predict the zeros of the Emden function and its corresponding relativistic functions. In its feed-forward back-propagation learning scheme, we used the ANN framework. The efficiency of the proposed algorithm is evaluated by running it through seven models concerning the polytropic indices-relativistic parameter pairs (n = 0, σ = 0.2), (n = 0.5, σ = 0.3), (n = 1, σ = 0.4), (n = 1.5, σ = 0.1), (n = 2, σ = 0.5), (n = 2.5, σ = 0.6), and (n = 3, σ = 0.7). The obtained solutions aided in the resolution improvement of relativistic polytropic gas sphere problems and the comparison between the analytical and the ANN solutions gives good agreement for the two cases under study.