We propose a method to describe consistent equations of state (EOS) for arbitrary systems. Complex EOS are traditionally obtained by fitting suitable analytical expressions to thermophysical data. A key aspect of EOS are that the relationships between state variables are given by derivatives of the system free energy. In this work, we model the free energy with an artificial neural network, and utilize automatic differentiation to directly learn to the derivatives of the free energy on two different data sets, the van der Waals system, and published data for the Lennard-Jones fluid. We show that this method is advantageous over direct learning of thermodynamic properties (i.e. not as derivatives of the free energy, but as independent properties), in terms of both accuracy and the exact preservation of the Maxwell relations. Furthermore, the method can implicitly solve the integration problem of computing the free energy of a system without explicit integration.