def _hash(self, regularizers=()):
def add(s):<EOL><INDENT>h.update(str(s).encode('<STR_LIT:utf-8>'))<EOL><DEDENT>h = hashlib.md5()<EOL>for l in self.layers:<EOL><INDENT>add('<STR_LIT>'.format(l.__class__.__name__, l.name, l.output_shape))<EOL><DEDENT>for l in self.losses:<EOL><INDENT>add('<STR_LIT>'.format(l.__class__.__name__, l.weight))<EOL><DEDENT>for r in regularizers:<EOL><INDENT>add('<STR_LIT>'.format(r.__class__.__name__, r.weight, r.pattern))<EOL><DEDENT>return h.hexdigest()<EOL>
Construct a string key for representing a computation graph.

        This key will be unique for a given (a) network topology, (b) set of
        losses, and (c) set of regularizers.

        Returns
        -------
        key : str
            A hash representing the computation graph for the current network.