We investigate the metric dependence of the partition function of the self-dual p-form gauge field on an arbitrary Riemannian manifold. Using geometric quantization of the space of middle-dimensional forms, we derive a projectively flat connection on its space of polarizations. This connection governs metric dependence of the partition function of the self-dual field. We show that the dependence is essentially given by the Cheeger half-torsion of the underlying manifold. We compute the local gravitational anomaly and show how our derivation relates to the classical computation based on index theory. As an application, we show that the one-loop determinant of the (2, 0) multiplet on a Calabi-Yau threefold coincides with the square root of the one-loop determinant of the B-model.