def __init__(self, dims, features):
        """
        M1+M2 model as described in (Kingma et al., 2014).

        :param dims: dimensions of the model given by [input_dim, label_dim, latent_dim, [hidden_dims]].
        :param classifier_net: classifier network class to use.
        :param features: a pre-trained M1 model of class 'VariationalAutoencoder' trained on the same dataset.
        """
        [x_dim, y_dim, z_dim, h_dim] = dims
        super(StackedDeepGenerativeModel, self).__init__([features.z_dim, y_dim, z_dim, h_dim])

        # Be sure to reconstruct with the same dimensions
        in_features = self.decoder.reconstruction.in_features
        self.decoder.reconstruction = nn.Linear(in_features, x_dim)

        # Make vae feature model untrainable by freezing parameters
        self.features = features
        self.features.train(False)

        for param in self.features.parameters():
            param.requires_grad = False

        M1+M2 model as described in (Kingma et al., 2014).

        :param dims: dimensions of the model given by [input_dim, label_dim, latent_dim, [hidden_dims]].
        :param classifier_net: classifier network class to use.
        :param features: a pre-trained M1 model of class 'VariationalAutoencoder' trained on the same dataset.
        
adbench/baseline/DeepSAD/src/networks/dgm.py