原因
変数名が被ってる。
chainerだと名前とかつけてなかったから、あまり見なかったエラー。
解決策
1.get_variableで変数名が被らないようにうまく生成する
with tf.variable_scope("my_scope2"):
v4_init = tf.constant_initializer([4.])
v4 = tf.get_variable("var4", shape=[1], initializer=v4_init)
print(v4.name) # my_scope2/var4:0
http://qiita.com/TomokIshii/items/ffe999b3e1a506c396c8
https://deepage.net/tensorflow/2017/06/02/tensorflow-variable.html
2.tf.reset_default_graph()で初期化。
jupyterなどで該当の行を2回目実行してる場合は初期化をすると通る。
あるいはjupyter再起動。
https://github.com/kratzert/finetune_alexnet_with_tensorflow/issues/8