-
-
Save abap34/0a10a4b48c94b92206b65d67e7e285a1 to your computer and use it in GitHub Desktop.
これは何 -> 今勉強用に作っているkwii名前のDLフレームワークのplot機能の実装です。動きません。どうして...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function plot(var::Variable, to_file = "graph.png") | |
dot_graph = get_dot_graph(var) | |
# varを末端にするグラフをdot言語にparseしたやつが帰ってきます | |
tmp_dir = join([expanduser("~"),".DeepShiba"], "/") | |
# dotファイルをここに置いておきます | |
(!(ispath(tmp_dir))) && (mkdir(tmp_dir)) | |
# なければ作る | |
dot_file_path = join([tmp_dir,"tmp_graph.dot"], "/") | |
# dotファイルの絶対パス | |
io = open(dot_file_path, "w") | |
write(io, dot_graph) | |
# 書き込む | |
extension = split(to_file, ".")[2] | |
# 拡張子を取得("hogehoge.png" -> "png") | |
to_file = join([pwd(), to_file], "/") | |
# 吐き出すファイルの絶対パス | |
cmd = `dot $(dot_file_path) -T $(extension) -o $(to_file)` | |
#= 実行するコマンド | |
(dot $(dotファイルのパス) -T $(拡張子) -o $(結果吐くファイルのパス)") | |
=# | |
run(cmd) | |
# どうして.............. | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment