两步法
- 定义计算
- 执行计算
计算图
- node: operations/variable
- edge: tensors
hello world code
1 | import tensorflow as tf |
1 | # Creates a graph. |
1 | g1 = tf.get_default_graph() |
热爱平淡,向往未知
1 | import tensorflow as tf |
1 | # Creates a graph. |
1 | g1 = tf.get_default_graph() |
1 | fout = open("out.txt", "w+") |
先找到
1 | tmux list-panes -a -F "#{pane_pid} #{pane_id}" | grep ^PID |
但是发现无法找到,查阅man
手册发现pane_pid PID of first process in pane
所以找到tty编号pts/159
1 | ps aux | grep 12934 | grep -v grep |
然后找对应session name
1 | tmux list-panes -a -F "#{pane_pid} #{pane_tty} sname:#{session_name} widx:#{window_index} pidx:#{pane_index}" | grep pts/159 |
1 | mat = torch.zeros((51, 48), dtype=torch.float, device=device) |
测试发现自带的调用一次需要0.1s………
自带的mse loss计算慢,自定义一个
1 | def self_mseloss(y_input, y_target): |
1 | torch.nn.Parameter() |
满屏的NaN gradient, 最后发现是因为sqrt 0的位置是没有导数的,写代码还需时刻查看是否可导
1 | $ pip freeze | grep lxml |
1 | cat requirements.txt | xargs -n 1 pip install |
~/.pip/pip.conf
1 | [global] |