{"action":"created","issue":{"url":"https://api.github.com/repos/flyyufelix/DenseNet-Keras/issues/1","repository_url":"https://api.github.com/repos/flyyufelix/DenseNet-Keras","labels_url":"https://api.github.com/repos/flyyufelix/DenseNet-Keras/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/flyyufelix/DenseNet-Keras/issues/1/comments","events_url":"https://api.github.com/repos/flyyufelix/DenseNet-Keras/issues/1/events","html_url":"https://github.com/flyyufelix/DenseNet-Keras/issues/1","id":229839491,"number":1,"title":"AttributeError: 'Tensor' object has no attribute 'assign'","user":{"login":"petteriTeikari","id":1060514,"avatar_url":"https://avatars0.githubusercontent.com/u/1060514?v=3","gravatar_id":"","url":"https://api.github.com/users/petteriTeikari","html_url":"https://github.com/petteriTeikari","followers_url":"https://api.github.com/users/petteriTeikari/followers","following_url":"https://api.github.com/users/petteriTeikari/following{/other_user}","gists_url":"https://api.github.com/users/petteriTeikari/gists{/gist_id}","starred_url":"https://api.github.com/users/petteriTeikari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petteriTeikari/subscriptions","organizations_url":"https://api.github.com/users/petteriTeikari/orgs","repos_url":"https://api.github.com/users/petteriTeikari/repos","events_url":"https://api.github.com/users/petteriTeikari/events{/privacy}","received_events_url":"https://api.github.com/users/petteriTeikari/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-05-19T00:28:34Z","updated_at":"2017-07-02T11:55:32Z","closed_at":null,"body":"Hi, \r\n\r\nThanks a lot for the repo, but I hit the following error when trying the `python test_inference.py` with the densenet169:\r\n\r\n```python\r\nTraceback (most recent call last):\r\n  File \"test_inference.py\", line 27, in <module>\r\n    model = DenseNet(reduction=0.5, classes=1000, weights_path=weights_path)\r\n  File \"densenet169.py\", line 78, in DenseNet\r\n    model.load_weights(weights_path, by_name=True)\r\n  File \"/home/petteri/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py\", line 2498, in load_weights\r\n    load_weights_from_hdf5_group_by_name(f, self.layers)\r\n  File \"/home/petteri/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py\", line 2976, in load_weights_from_hdf5_group_by_name\r\n    K.batch_set_value(weight_value_tuples)\r\n  File \"/home/petteri/anaconda3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py\", line 2025, in batch_set_value\r\n    assign_op = x.assign(assign_placeholder)\r\nAttributeError: 'Tensor' object has no attribute 'assign'\r\n```\r\n\r\nSo when printing the types of the variables in the saved weights I got the following:\r\n```\r\n<tf.Variable 'conv1/kernel:0' shape=(7, 7, 3, 64) dtype=float32_ref>\r\n<tf.Variable 'conv1_bn/gamma:0' shape=(64,) dtype=float32_ref>\r\n<tf.Variable 'conv1_bn/beta:0' shape=(64,) dtype=float32_ref>\r\n<tf.Variable 'conv1_bn/moving_mean:0' shape=(64,) dtype=float32_ref>\r\n<tf.Variable 'conv1_bn/moving_variance:0' shape=(64,) dtype=float32_ref>\r\nTensor(\"conv1_scale/Const:0\", shape=(64,), dtype=float32)\r\n```\r\n\r\nAnd the `batch_set_value(tuples)` from the backend hit the Tensor problem with \"conv1_scale\", is there a fix for this to allow the assigning or are the weights somewhat weirdly saved?:\r\n```\r\n            if hasattr(x, '_assign_placeholder'):\r\n                assign_placeholder = x._assign_placeholder\r\n                assign_op = x._assign_op\r\n            else:\r\n                assign_placeholder = tf.placeholder(tf_dtype, shape=value.shape)\r\n                assign_op = x.assign(assign_placeholder)\r\n                x._assign_placeholder = assign_placeholder\r\n                x._assign_op = assign_op\r\n            assign_ops.append(assign_op)\r\n            feed_dict[assign_placeholder] = value\r\n```"},"comment":{"url":"https://api.github.com/repos/flyyufelix/DenseNet-Keras/issues/comments/312487457","html_url":"https://github.com/flyyufelix/DenseNet-Keras/issues/1#issuecomment-312487457","issue_url":"https://api.github.com/repos/flyyufelix/DenseNet-Keras/issues/1","id":312487457,"user":{"login":"flyyufelix","id":640082,"avatar_url":"https://avatars2.githubusercontent.com/u/640082?v=3","gravatar_id":"","url":"https://api.github.com/users/flyyufelix","html_url":"https://github.com/flyyufelix","followers_url":"https://api.github.com/users/flyyufelix/followers","following_url":"https://api.github.com/users/flyyufelix/following{/other_user}","gists_url":"https://api.github.com/users/flyyufelix/gists{/gist_id}","starred_url":"https://api.github.com/users/flyyufelix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyyufelix/subscriptions","organizations_url":"https://api.github.com/users/flyyufelix/orgs","repos_url":"https://api.github.com/users/flyyufelix/repos","events_url":"https://api.github.com/users/flyyufelix/events{/privacy}","received_events_url":"https://api.github.com/users/flyyufelix/received_events","type":"User","site_admin":false},"created_at":"2017-07-02T11:55:32Z","updated_at":"2017-07-02T11:55:32Z","body":"Apologize for the delay @petteriTeikari  . I've already made the necessary changes to get the code to work with the latest versions of Keras (2.0.5) and TensorFlow (1.2.1)"}}
{"actor":{"display_login":"flyyufelix"}}