yobx.helpers.dot_helper#

yobx.helpers.dot_helper.to_dot(model: ModelProto) str[source]#

Converts a model into a dot graph. Here is an example:

digraph { graph [rankdir=TB, splines=true, overlap=false, nodesep=0.2, ranksep=0.2, fontsize=8]; node [style="rounded,filled", color="#888888", fontcolor="#222222", shape=box]; edge [arrowhead=vee, fontsize=7, labeldistance=-5, labelangle=0]; I_0 [label="X\nFLOAT(batch,seq,4)", fillcolor="#aaeeaa"]; I_1 [label="Y\nFLOAT(batch,seq,4)", fillcolor="#aaeeaa"]; i_2 [label="W\nFLOAT(4, 2)", fillcolor="#cccc00"]; Add_3 [label="Add(., .)", fillcolor="#cccccc"]; MatMul_4 [label="MatMul(., .)", fillcolor="#ee9999"]; Relu_5 [label="Relu(.)", fillcolor="#cccccc"]; I_0 -> Add_3 [label="FLOAT(batch,seq,4)"]; I_1 -> Add_3 [label="FLOAT(batch,seq,4)"]; Add_3 -> MatMul_4 [label="FLOAT(batch,seq,4)"]; i_2 -> MatMul_4 [label="FLOAT(4, 2)"]; MatMul_4 -> Relu_5 [label="FLOAT(batch,seq,2)"]; O_6 [label="Z\nFLOAT(batch,seq,2)", fillcolor="#aaaaee"]; Relu_5 -> O_6; }

yobx.helpers.dot_helper.to_svg(dot: str) str[source]#

Converts a DOT string into an SVG string by calling the dot command-line tool.

Parameters:

dot – DOT graph source, e.g. as returned by to_dot()

Returns:

SVG content as a UTF-8 string

Raises: