{"action":"created","issue":{"url":"https://api.github.com/repos/tflearn/tflearn/issues/71","repository_url":"https://api.github.com/repos/tflearn/tflearn","labels_url":"https://api.github.com/repos/tflearn/tflearn/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/tflearn/tflearn/issues/71/comments","events_url":"https://api.github.com/repos/tflearn/tflearn/issues/71/events","html_url":"https://github.com/tflearn/tflearn/issues/71","id":154627918,"number":71,"title":"Assign requires shapes of both tensors to match, restore=False","user":{"login":"FreakTheMighty","id":247092,"avatar_url":"https://avatars.githubusercontent.com/u/247092?v=3","gravatar_id":"","url":"https://api.github.com/users/FreakTheMighty","html_url":"https://github.com/FreakTheMighty","followers_url":"https://api.github.com/users/FreakTheMighty/followers","following_url":"https://api.github.com/users/FreakTheMighty/following{/other_user}","gists_url":"https://api.github.com/users/FreakTheMighty/gists{/gist_id}","starred_url":"https://api.github.com/users/FreakTheMighty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FreakTheMighty/subscriptions","organizations_url":"https://api.github.com/users/FreakTheMighty/orgs","repos_url":"https://api.github.com/users/FreakTheMighty/repos","events_url":"https://api.github.com/users/FreakTheMighty/events{/privacy}","received_events_url":"https://api.github.com/users/FreakTheMighty/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-05-13T03:41:55Z","updated_at":"2016-10-08T03:00:49Z","closed_at":"2016-05-14T10:06:02Z","body":"I am attempting to \"finetune\" a model, and alter the last three layers of the network. The network is essentially VGG\r\n\r\nInitially I had trained with these last three layers:\r\n\r\n```python\r\nnetwork = fully_connected(network, 1024, activation='relu')\r\nnetwork = dropout(network, 0.5)\r\nnetwork = fully_connected(network, 1024, activation='relu')\r\nnetwork = dropout(network, 0.5)\r\nnetwork = fully_connected(network, 256, activation='relu')\r\n```\r\n\r\nI then attempted to fine tune, with these layers:\r\n\r\n```python\r\nnetwork = fully_connected(network, 4096, activation='relu', restore=False)\r\nnetwork = dropout(network, 0.5)\r\nnetwork = fully_connected(network, 4096, activation='relu', restore=False)\r\nnetwork = dropout(network, 0.5)\r\nnetwork = fully_connected(network, 256, activation='relu', restore=False)\r\n```\r\n\r\nI get this error:\r\n```\r\ntensorflow.python.framework.errors.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [3136,4096] rhs shape= [3136,1024]\r\n```\r\n\r\nIt makes sense that the loaded model weights can't be restored onto these newly shaped layers, but I expect that was what `restore=False` would do.  Thank you in advance for the great project and whatever help you can offer."},"comment":{"url":"https://api.github.com/repos/tflearn/tflearn/issues/comments/252398583","html_url":"https://github.com/tflearn/tflearn/issues/71#issuecomment-252398583","issue_url":"https://api.github.com/repos/tflearn/tflearn/issues/71","id":252398583,"user":{"login":"MrZhw","id":15373554,"avatar_url":"https://avatars.githubusercontent.com/u/15373554?v=3","gravatar_id":"","url":"https://api.github.com/users/MrZhw","html_url":"https://github.com/MrZhw","followers_url":"https://api.github.com/users/MrZhw/followers","following_url":"https://api.github.com/users/MrZhw/following{/other_user}","gists_url":"https://api.github.com/users/MrZhw/gists{/gist_id}","starred_url":"https://api.github.com/users/MrZhw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrZhw/subscriptions","organizations_url":"https://api.github.com/users/MrZhw/orgs","repos_url":"https://api.github.com/users/MrZhw/repos","events_url":"https://api.github.com/users/MrZhw/events{/privacy}","received_events_url":"https://api.github.com/users/MrZhw/received_events","type":"User","site_admin":false},"created_at":"2016-10-08T03:00:49Z","updated_at":"2016-10-08T03:00:49Z","body":"Hi, I'm using the translate model under tensorflow(0.8), and get follow error:\r\nzeng@zeng-Aspire:~/tensorflow/tensorflow/models/rnn/translate$ python translate.py --decode --data_dir /home/zeng/data/comic/ --size=256 --num_layers=2\r\nReading model parameters from /home/zeng/data/comic/checkpoint/translate.ckpt-40000\r\nTraceback (most recent call last):\r\n  File \"translate.py\", line 305, in <module>\r\n    tf.app.run()\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py\", line 30, in run\r\n    sys.exit(main(sys.argv))\r\n  File \"translate.py\", line 300, in main\r\n    decode()\r\n  File \"translate.py\", line 232, in decode\r\n    model = create_model(sess, True)\r\n  File \"translate.py\", line 145, in create_model\r\n    model.saver.restore(session, ckpt_path)\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/saver.py\", line 1090, in restore\r\n    {self.saver_def.filename_tensor_name: save_path})\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py\", line 340, in run\r\n    run_metadata_ptr)\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py\", line 564, in _run\r\n    feed_dict_string, options, run_metadata)\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py\", line 637, in _do_run\r\n    target_list, options, run_metadata)\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py\", line 659, in _do_call\r\n    e.code)\r\ntensorflow.python.framework.errors.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [256,40000] rhs shape= [40000,256]\r\n\t [[Node: save/Assign_29 = Assign[T=DT_FLOAT, _class=[\"loc:@proj_w\"], use_locking=true, validate_shape=true, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](proj_w, save/restore_slice_29)]]\r\nCaused by op u'save/Assign_29', defined at:\r\n  File \"translate.py\", line 305, in <module>\r\n    tf.app.run()\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py\", line 30, in run\r\n    sys.exit(main(sys.argv))\r\n  File \"translate.py\", line 300, in main\r\n    decode()\r\n  File \"translate.py\", line 232, in decode\r\n    model = create_model(sess, True)\r\n  File \"translate.py\", line 136, in create_model\r\n    forward_only=forward_only)\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/models/rnn/translate/seq2seq_model.py\", line 168, in __init__\r\n    self.saver = tf.train.Saver(tf.all_variables())\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/saver.py\", line 832, in __init__\r\n    restore_sequentially=restore_sequentially)\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/saver.py\", line 502, in build\r\n    filename_tensor, vars_to_save, restore_sequentially, reshape)\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/saver.py\", line 268, in _AddRestoreOps\r\n    validate_shape=validate_shape))\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_state_ops.py\", line 40, in assign\r\n    use_locking=use_locking, name=name)\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/op_def_library.py\", line 655, in apply_op\r\n    op_def=op_def)\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py\", line 2154, in create_op\r\n    original_op=self._default_original_op, op_def=op_def)\r\n  File \"/home/zeng/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py\", line 1154, in __init__\r\n    self._traceback = _extract_stack()\r\nsorry, I don't understand how to fix it, where should I change"}}
{"actor":{"display_login":"MrZhw"}}