Generating a child network using the Controller

Now, we implement a method that generates a child network using the Controller:

def generate_child_network(self, child_network_architecture):    with self.graph.as_default():        return, {self.child_network_architectures: child_network_architecture})

Once we generate our child network, we call the train_child_network function to train it. This function takes child_dna and child_id and returns the validation accuracy that the child network achieves. First, we instantiate a new tf.Graph() and a new tf.Session() so that the child network is separated from the Controller's graph:

def train_child_network(self, cnn_dna, child_id):    """ Trains a child network and returns reward, ...

Get Python Reinforcement Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.