  A hypothetical photon mass, $m_{\gamma}$, can produce a frequency-dependent
vacuum dispersion of light, which leads to an additional time delay between
photons with different frequencies when they propagate through a fixed
distance. The dispersion measure--redshift measurements of fast radio bursts
(FRBs) have been widely used to constrain the rest mass of the photon. However,
all current studies analyzed the effect of the frequency-dependent dispersion
for massive photons in the standard $\Lambda$CDM cosmological context. In order
to alleviate the circularity problem induced by the presumption of a specific
cosmological model based on the fundamental postulate of the masslessness of
photons, here we employ a new model-independent smoothing technique, Artificial
Neural Network (ANN), to reconstruct the Hubble parameter $H(z)$ function from
34 cosmic-chronometer measurements. By combining observations of 32
well-localized FRBs and the $H(z)$ function reconstructed by ANN, we obtain an
upper limit of $m_{\gamma} \le 3.5 \times 10^{-51}\;\rm{kg}$, or equivalently
$m_{\gamma} \le 2.0 \times 10^{-15}\;\rm{eV/c^2}$ ($m_{\gamma} \le 6.5 \times
10^{-51}\;\rm{kg}$, or equivalently $m_{\gamma} \le 3.6 \times
10^{-15}\;\rm{eV/c^2}$) at the $1\sigma$ ($2\sigma$) confidence level. This is
the first cosmology-independent photon mass limit derived from extragalactic
sources.
