def build_graph(self, regularizers=()):
key = self._hash(regularizers)<EOL>if key not in self._graphs:<EOL><INDENT>util.log('<STR_LIT>')<EOL>for loss in self.losses:<EOL><INDENT>loss.log()<EOL><DEDENT>for reg in regularizers:<EOL><INDENT>reg.log()<EOL><DEDENT>outputs = {}<EOL>updates = []<EOL>for layer in self.layers:<EOL><INDENT>out, upd = layer.connect(outputs)<EOL>for reg in regularizers:<EOL><INDENT>reg.modify_graph(out)<EOL><DEDENT>outputs.update(out)<EOL>updates.extend(upd)<EOL><DEDENT>self._graphs[key] = outputs, updates<EOL><DEDENT>return self._graphs[key]<EOL>
Connect the layers in this network to form a computation graph.

        Parameters
        ----------
        regularizers : list of :class:`theanets.regularizers.Regularizer`
            A list of the regularizers to apply while building the computation
            graph.

        Returns
        -------
        outputs : list of Theano variables
            A list of expressions giving the output of each layer in the graph.
        updates : list of update tuples
            A list of updates that should be performed by a Theano function that
            computes something using this graph.