From 4f21c1b179f7df18c905e0cb42cbe7271ad1fb9f Mon Sep 17 00:00:00 2001 From: dolphin8 Date: Mon, 16 Jul 2018 11:49:44 +0800 Subject: [PATCH] add net draw script --- tools/net.awk | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tools/net.awk diff --git a/tools/net.awk b/tools/net.awk new file mode 100644 index 0000000000..25689c90d8 --- /dev/null +++ b/tools/net.awk @@ -0,0 +1,27 @@ +BEGIN { + print "digraph {" +} +/op:/ { + id++ + op = $NF + opname = op "_" id + print opname "[\"label\"=\"" op " [" id "]" "\"]" +} +/input/ { + type = "input" +} +/output/ { + type = "output" +} +/argument/ { + if (type == "output") { + output[$NF] = opname + } else if (type == "input") { + if (output[$NF]) { + print output[$NF] " -> " opname + } + } +} +END { + print "}" +} -- GitLab