  In traditional topology optimization, the computing time required to
iteratively update the material distribution within a design domain strongly
depends on the complexity or size of the problem, limiting its application in
real engineering contexts. This work proposes a multi-stage machine learning
strategy that aims to predict an optimal topology and the related stress fields
of interest, either in 2D or 3D, without resorting to any iterative analysis
and design process. The overall topology optimization is treated as regression
task in a low-dimensional latent space, that encodes the variability of the
target designs. First, a fully-connected model is employed to surrogate the
functional link between the parametric input space characterizing the design
problem and the latent space representation of the corresponding optimal
topology. The decoder branch of an autoencoder is then exploited to reconstruct
the desired optimal topology from its latent representation. The deep learning
models are trained on a dataset generated through a standard method of topology
optimization implementing the solid isotropic material with penalization, for
varying boundary and loading conditions. The underlying hypothesis behind the
proposed strategy is that optimal topologies share enough common patterns to be
compressed into small latent space representations without significant
information loss. Results relevant to a 2D Messerschmitt-B\"olkow-Blohm beam
and a 3D bridge case demonstrate the capabilities of the proposed framework to
provide accurate optimal topology predictions in a fraction of a second.
