How to use the visualdl.server.graphviz_graph.Graph function in visualdl

To help you get started, we’ve selected a few visualdl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PaddlePaddle / VisualDL / visualdl / server / graphviz_graph.py View on Github external
def rank_group(self, kind, priority):
        name = "rankgroup-%d" % Graph.rank_counter
        Graph.rank_counter += 1
        rank = Rank(kind, name, priority)
        self.rank_groups[name] = rank
        return name
github PaddlePaddle / VisualDL / visualdl / server / graphviz_graph.py View on Github external
'''
        self.source = source
        self.target = target
        self.attrs = attrs

    def __str__(self):
        repr = "{source} -> {target} {extra}".format(
            source=self.source.name,
            target=self.target.name,
            extra="" if not self.attrs else
            "[" + ','.join("{}={}".format(attr[0], crepr(attr[1]))
                           for attr in self.attrs.items()) + "]")
        return repr


g_graph = Graph(title="some model")


def add_param(label, graph=None):
    if not graph:
        graph = g_graph
    return graph.node(label=label, prefix='param', color='blue')


def add_op(label, graph=None):
    if not graph:
        graph = g_graph
    label = '\n'.join([
        '',
        '  ',
        '    <table border="0"><tbody><tr><td>',
        label,</td></tr></tbody></table>