'Retrieves the weights of the model.
# Returns
A flat list of Numpy arrays
(one array per model weight).'

def get_weights(self):

    if legacy_models.needs_legacy_support(self):
        layers = legacy_models.legacy_sequential_layers(self)
        weights = []
        for layer in layers:
            weights.append(layer.get_weights())
        return weights
    if (not self.built):
        self.build()
    return self.model.get_weights()
