  Active quantum error correction is a central ingredient to achieve robust
quantum processors. In this paper we investigate the potential of quantum
machine learning for quantum error correction in a quantum memory.
Specifically, we demonstrate how quantum neural networks, in the form of
quantum autoencoders, can be trained to learn optimal strategies for active
detection and correction of errors, including spatially correlated
computational errors as well as qubit losses. We highlight that the denoising
capabilities of quantum autoencoders are not limited to the protection of
specific states but extend to the entire logical codespace. We also show that
quantum neural networks can be used to discover new logical encodings that are
optimally adapted to the underlying noise. Moreover, we find that, even in the
presence of moderate noise in the quantum autoencoders themselves, they may
still be successfully used to perform beneficial quantum error correction and
thereby extend the lifetime of a logical qubit.
