Gels are polymers that can imbibe large amounts of solvent and generate large volumetric deformations in a process commonly termed swelling. The swelling-induced deformations can be harnessed to produce pressure against surrounding elastic elements, and therefore lead to spatial shape changes without the need for an external energy source. In the present paper, we consider a thin cylindrical elastic tube that encapsulates a gel and deforms in response to the swelling-induced forces. It is expected that by controlling the spatial stiffness distribution of the tube, the deformed swelling-induced shape can be programmed. We exploit this simple idea to obtain controlled shape change driven by the large volumetric expansion of gels. To this end, we train a machine learning algorithm through many FE simulations that enable solving the inverse problem: for any prescribed swelling-induced target shape, the algorithm provides the spatial stiffness distribution of the thin tube. The results confirm that precise controlled shape change is achievable by exploiting the large swelling-induced volumetric deformations in an autonomous manner (i.e. without the need for any external energy source). This work paves the way for new perspectives in the design of shape-change systems based on the simple yet proper elastic distribution of confining structures.