  The optical depth to reionization, $\tau$, is the least constrained parameter
of the cosmological $\Lambda$CDM model. To date, its most precise value is
inferred from large-scale polarized CMB power spectra from the ${\it Planck}$
High-Frequency Instrument (HFI). These maps are known to contain significant
contamination by residual non-Gaussian systematic effects, which are hard to
model analytically. Therefore, robust constraints on $\tau$ are currently
obtained through an empirical cross-spectrum likelihood built from simulations.
In this paper, we present a likelihood-free inference of $\tau$ from polarized
${\it Planck}$ HFI maps which, for the first time, is fully based on neural
networks (NNs). NNs have the advantage of not requiring an analytical
description of the data and can be trained on state-of-the-art simulations,
combining information from multiple channels. By using Gaussian sky simulations
and ${\it Planck}$ ${\tt SRoll2}$ simulations, including CMB, noise, and
residual instrumental systematic effects, we train, test and validate NN models
considering different setups. We infer the value of $\tau$ directly from $Q$
and $U$ maps at $\sim 4^\circ$ pixel resolution, without computing power
spectra. On ${\it Planck}$ data, we obtain $\tau_{NN}=0.058 \pm 0.008$,
compatible with current EE cross-spectrum results but with a $\sim30\%$ larger
uncertainty, which can be assigned to the inherent non-optimality of our
estimator and to the retraining procedure applied to avoid biases. While this
paper does not improve on current cosmological constraints, our analysis
represents a first robust application of NN-based inference on real data and
highlights its potential as a promising tool for complementary analysis of
near-future CMB experiments, also in view of the ongoing challenge to achieve a
detection of primordial gravitational waves.
