Skip to content

Commit

Permalink
added script to pydot
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Feb 6, 2020
1 parent 51a198d commit 74cf058
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/pre_train/dot_manual.bat
@@ -0,0 +1 @@
dot -Tpng -O test\pre_train\sample.dot
154 changes: 154 additions & 0 deletions test/pre_train/sample.dot
@@ -0,0 +1,154 @@
digraph Net {
rankdir=TB;
"features.0" [fillcolor="#6495ED", label="features.0\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.1" [fillcolor="#6495ED", label="features.1\nRelu", shape=record, style="rounded, filled"];
"features.2" [fillcolor="#6495ED", label="features.2\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.3" [fillcolor="#6495ED", label="features.3\nRelu", shape=record, style="rounded, filled"];
"features.4" [fillcolor="#6495ED", label="features.4\nMaxPool", shape=record, style="rounded, filled"];
"features.5" [fillcolor="#6495ED", label="features.5\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.6" [fillcolor="#6495ED", label="features.6\nRelu", shape=record, style="rounded, filled"];
"features.7" [fillcolor="#6495ED", label="features.7\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.8" [fillcolor="#6495ED", label="features.8\nRelu", shape=record, style="rounded, filled"];
"features.9" [fillcolor="#6495ED", label="features.9\nMaxPool", shape=record, style="rounded, filled"];
"features.10" [fillcolor="#6495ED", label="features.10\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.11" [fillcolor="#6495ED", label="features.11\nRelu", shape=record, style="rounded, filled"];
"features.12" [fillcolor="#6495ED", label="features.12\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.13" [fillcolor="#6495ED", label="features.13\nRelu", shape=record, style="rounded, filled"];
"features.14" [fillcolor="#6495ED", label="features.14\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.15" [fillcolor="#6495ED", label="features.15\nRelu", shape=record, style="rounded, filled"];
"features.16" [fillcolor="#6495ED", label="features.16\nMaxPool", shape=record, style="rounded, filled"];
"features.17" [fillcolor="#6495ED", label="features.17\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.18" [fillcolor="#6495ED", label="features.18\nRelu", shape=record, style="rounded, filled"];
"features.19" [fillcolor="#6495ED", label="features.19\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.20" [fillcolor="#6495ED", label="features.20\nRelu", shape=record, style="rounded, filled"];
"features.21" [fillcolor="#6495ED", label="features.21\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.22" [fillcolor="#6495ED", label="features.22\nRelu", shape=record, style="rounded, filled"];
"features.23" [fillcolor="#6495ED", label="features.23\nMaxPool", shape=record, style="rounded, filled"];
"features.24" [fillcolor="#6495ED", label="features.24\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.25" [fillcolor="#6495ED", label="features.25\nRelu", shape=record, style="rounded, filled"];
"features.26" [fillcolor="#6495ED", label="features.26\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.27" [fillcolor="#6495ED", label="features.27\nRelu", shape=record, style="rounded, filled"];
"features.28" [fillcolor="#6495ED", label="features.28\nConv\nsh=(3, 3)\ng=1", shape=record, style="rounded, filled"];
"features.29" [fillcolor="#6495ED", label="features.29\nRelu", shape=record, style="rounded, filled"];
"features.30" [fillcolor="#6495ED", label="features.30\nMaxPool", shape=record, style="rounded, filled"];
avgpool [fillcolor="#6495ED", label="avgpool\nAveragePool", shape=record, style="rounded, filled"];
top_level_op [fillcolor="#6495ED", label="top_level_op\nFlatten", shape=record, style="rounded, filled"];
"classifier.0" [fillcolor="#6495ED", label="classifier.0\nGemm", shape=record, style="rounded, filled"];
"classifier.1" [fillcolor="#6495ED", label="classifier.1\nRelu", shape=record, style="rounded, filled"];
"classifier.3" [fillcolor="#6495ED", label="classifier.3\nGemm", shape=record, style="rounded, filled"];
"classifier.4" [fillcolor="#6495ED", label="classifier.4\nRelu", shape=record, style="rounded, filled"];
"classifier.6" [fillcolor="#6495ED", label="classifier.6\nGemm", shape=record, style="rounded, filled"];
70 [label="1000\n(1, 1000)"];
33 [label="3211264\n(1, 64, 224, 224)"];
34 [label="3211264\n(1, 64, 224, 224)"];
35 [label="3211264\n(1, 64, 224, 224)"];
36 [label="3211264\n(1, 64, 224, 224)"];
37 [label="802816\n(1, 64, 112, 112)"];
38 [label="1605632\n(1, 128, 112, 112)"];
39 [label="1605632\n(1, 128, 112, 112)"];
40 [label="1605632\n(1, 128, 112, 112)"];
41 [label="1605632\n(1, 128, 112, 112)"];
42 [label="401408\n(1, 128, 56, 56)"];
43 [label="802816\n(1, 256, 56, 56)"];
44 [label="802816\n(1, 256, 56, 56)"];
45 [label="802816\n(1, 256, 56, 56)"];
46 [label="802816\n(1, 256, 56, 56)"];
47 [label="802816\n(1, 256, 56, 56)"];
48 [label="802816\n(1, 256, 56, 56)"];
49 [label="200704\n(1, 256, 28, 28)"];
50 [label="401408\n(1, 512, 28, 28)"];
51 [label="401408\n(1, 512, 28, 28)"];
52 [label="401408\n(1, 512, 28, 28)"];
53 [label="401408\n(1, 512, 28, 28)"];
54 [label="401408\n(1, 512, 28, 28)"];
55 [label="401408\n(1, 512, 28, 28)"];
56 [label="100352\n(1, 512, 14, 14)"];
57 [label="100352\n(1, 512, 14, 14)"];
58 [label="100352\n(1, 512, 14, 14)"];
59 [label="100352\n(1, 512, 14, 14)"];
60 [label="100352\n(1, 512, 14, 14)"];
61 [label="100352\n(1, 512, 14, 14)"];
62 [label="100352\n(1, 512, 14, 14)"];
63 [label="25088\n(1, 512, 7, 7)"];
64 [label="25088\n(1, 512, 7, 7)"];
65 [label="25088\n(1, 25088)"];
66 [label="4096\n(1, 4096)"];
67 [label="4096\n(1, 4096)"];
68 [label="4096\n(1, 4096)"];
69 [label="4096\n(1, 4096)"];
"features.0" -> 33;
33 -> "features.1";
"features.1" -> 34;
34 -> "features.2";
"features.2" -> 35;
35 -> "features.3";
"features.3" -> 36;
36 -> "features.4";
"features.4" -> 37;
37 -> "features.5";
"features.5" -> 38;
38 -> "features.6";
"features.6" -> 39;
39 -> "features.7";
"features.7" -> 40;
40 -> "features.8";
"features.8" -> 41;
41 -> "features.9";
"features.9" -> 42;
42 -> "features.10";
"features.10" -> 43;
43 -> "features.11";
"features.11" -> 44;
44 -> "features.12";
"features.12" -> 45;
45 -> "features.13";
"features.13" -> 46;
46 -> "features.14";
"features.14" -> 47;
47 -> "features.15";
"features.15" -> 48;
48 -> "features.16";
"features.16" -> 49;
49 -> "features.17";
"features.17" -> 50;
50 -> "features.18";
"features.18" -> 51;
51 -> "features.19";
"features.19" -> 52;
52 -> "features.20";
"features.20" -> 53;
53 -> "features.21";
"features.21" -> 54;
54 -> "features.22";
"features.22" -> 55;
55 -> "features.23";
"features.23" -> 56;
56 -> "features.24";
"features.24" -> 57;
57 -> "features.25";
"features.25" -> 58;
58 -> "features.26";
"features.26" -> 59;
59 -> "features.27";
"features.27" -> 60;
60 -> "features.28";
"features.28" -> 61;
61 -> "features.29";
"features.29" -> 62;
62 -> "features.30";
"features.30" -> 63;
63 -> avgpool;
avgpool -> 64;
64 -> top_level_op;
top_level_op -> 65;
65 -> "classifier.0";
"classifier.0" -> 66;
66 -> "classifier.1";
"classifier.1" -> 67;
67 -> "classifier.3";
"classifier.3" -> 68;
68 -> "classifier.4";
"classifier.4" -> 69;
69 -> "classifier.6";
"classifier.6" -> 70;
}
14 changes: 14 additions & 0 deletions test/pre_train/test_pydot.py
@@ -0,0 +1,14 @@
import pydot

g = pydot.Dot()
g.set_type('digraph')
node = pydot.Node('legend')
node.set("shape", 'box')
g.add_node(node)
node.set('label', 'mine')
s = g.to_string()
expected = 'digraph G {\nlegend [label=mine, shape=box];\n}\n'
assert s == expected
print(s)
png = g.create_png()
print(png)

0 comments on commit 74cf058

Please sign in to comment.