{"action":"created","issue":{"url":"https://api.github.com/repos/kevinzakka/spatial-transformer-network/issues/14","repository_url":"https://api.github.com/repos/kevinzakka/spatial-transformer-network","labels_url":"https://api.github.com/repos/kevinzakka/spatial-transformer-network/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/kevinzakka/spatial-transformer-network/issues/14/comments","events_url":"https://api.github.com/repos/kevinzakka/spatial-transformer-network/issues/14/events","html_url":"https://github.com/kevinzakka/spatial-transformer-network/issues/14","id":328724814,"node_id":"MDU6SXNzdWUzMjg3MjQ4MTQ=","number":14,"title":"A Running Error Using Tensorflow 1.8.0","user":{"login":"LiChenyang-Github","id":20487119,"node_id":"MDQ6VXNlcjIwNDg3MTE5","avatar_url":"https://avatars0.githubusercontent.com/u/20487119?v=4","gravatar_id":"","url":"https://api.github.com/users/LiChenyang-Github","html_url":"https://github.com/LiChenyang-Github","followers_url":"https://api.github.com/users/LiChenyang-Github/followers","following_url":"https://api.github.com/users/LiChenyang-Github/following{/other_user}","gists_url":"https://api.github.com/users/LiChenyang-Github/gists{/gist_id}","starred_url":"https://api.github.com/users/LiChenyang-Github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LiChenyang-Github/subscriptions","organizations_url":"https://api.github.com/users/LiChenyang-Github/orgs","repos_url":"https://api.github.com/users/LiChenyang-Github/repos","events_url":"https://api.github.com/users/LiChenyang-Github/events{/privacy}","received_events_url":"https://api.github.com/users/LiChenyang-Github/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-02T08:07:29Z","updated_at":"2018-06-02T09:31:43Z","closed_at":null,"author_association":"NONE","body":"My tensorflow version is 1.8.0\r\nI clone the code to my computer and download the `mnist_cluttered_60x60_6distortions.npz` dataset into `./data/`.            \r\nWhen I run the main.py, I get the following ERROR:\r\n\r\n```\r\nLoading the data...\r\nBuilding ConvNet...\r\nTraceback (most recent call last):\r\n  File \"/home/xinlab/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py\", line 517, in make_tensor_proto\r\n    str_values = [compat.as_bytes(x) for x in proto_values]\r\n  File \"/home/xinlab/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py\", line 517, in <listcomp>\r\n    str_values = [compat.as_bytes(x) for x in proto_values]\r\n  File \"/home/xinlab/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/compat.py\", line 67, in as_bytes\r\n    (bytes_or_text,))\r\nTypeError: Expected binary or unicode string, got -1\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"main.py\", line 422, in <module>\r\n    main()\r\n  File \"main.py\", line 275, in main\r\n    pool3_flat, pool3_size = Flatten(pool3)\r\n  File \"/home/LiChenyang/spatial-transformer-network/utils/layer_utils.py\", line 85, in Flatten\r\n    layer_flat = tf.reshape(layer, [-1, num_features])\r\n  File \"/home/xinlab/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py\", line 6113, in reshape\r\n    \"Reshape\", tensor=tensor, shape=shape, name=name)\r\n  File \"/home/xinlab/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py\", line 513, in _apply_op_helper\r\n    raise err\r\n  File \"/home/xinlab/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py\", line 510, in _apply_op_helper\r\n    preferred_dtype=default_dtype)\r\n  File \"/home/xinlab/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py\", line 1104, in internal_convert_to_tensor\r\n    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)\r\n  File \"/home/xinlab/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py\", line 235, in _constant_tensor_conversion_function\r\n    return constant(v, dtype=dtype, name=name)\r\n  File \"/home/xinlab/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py\", line 214, in constant\r\n    value, dtype=dtype, shape=shape, verify_shape=verify_shape))\r\n  File \"/home/xinlab/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py\", line 521, in make_tensor_proto\r\n    \"supported type.\" % (type(values), values))\r\nTypeError: Failed to convert object of type <class 'list'> to Tensor. Contents: [-1, None]. Consider casting elements to a supported type.\r\nLiChenyang@ubuntu:~/spatial-transformer-network$\r\n```\r\n\r\nAny idea to fix this problem?"},"comment":{"url":"https://api.github.com/repos/kevinzakka/spatial-transformer-network/issues/comments/394073444","html_url":"https://github.com/kevinzakka/spatial-transformer-network/issues/14#issuecomment-394073444","issue_url":"https://api.github.com/repos/kevinzakka/spatial-transformer-network/issues/14","id":394073444,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDA3MzQ0NA==","user":{"login":"LiChenyang-Github","id":20487119,"node_id":"MDQ6VXNlcjIwNDg3MTE5","avatar_url":"https://avatars0.githubusercontent.com/u/20487119?v=4","gravatar_id":"","url":"https://api.github.com/users/LiChenyang-Github","html_url":"https://github.com/LiChenyang-Github","followers_url":"https://api.github.com/users/LiChenyang-Github/followers","following_url":"https://api.github.com/users/LiChenyang-Github/following{/other_user}","gists_url":"https://api.github.com/users/LiChenyang-Github/gists{/gist_id}","starred_url":"https://api.github.com/users/LiChenyang-Github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LiChenyang-Github/subscriptions","organizations_url":"https://api.github.com/users/LiChenyang-Github/orgs","repos_url":"https://api.github.com/users/LiChenyang-Github/repos","events_url":"https://api.github.com/users/LiChenyang-Github/events{/privacy}","received_events_url":"https://api.github.com/users/LiChenyang-Github/received_events","type":"User","site_admin":false},"created_at":"2018-06-02T09:31:43Z","updated_at":"2018-06-02T09:31:43Z","author_association":"NONE","body":"I guess the error is due to the last dimension of the target shape is None(i.e. [-1, None]) when execute the code: `layer_flat = tf.reshape(layer, [-1, num_features])`.        \r\nI try to print the `h_trans` and `pool3` in `main()`, and I get:\r\n\r\n`Tensor(\"AddN:0\", shape=(?, ?, ?, 1), dtype=float32)`      \r\n`Tensor(\"Relu_5:0\", shape=(?, ?, ?, 128), dtype=float32)`      \r\n\r\nThe second and third dimension of `h_trans` is '?', which makes `num_features` in `Flatten()` None.        \r\n\r\nTo verify this idea, I add a new function in `./utils/layer_utils.py`:\r\n```\r\ndef Flatten_test(layer):\r\n\t\"\"\"\r\n\tHandy function for flattening the result of a conv2D or\r\n\tmaxpool2D to be used for a fully-connected (affine) layer.\r\n\t\"\"\"\r\n\t# layer_shape = layer.get_shape()\r\n\t# # num_features = tf.reduce_prod(tf.shape(layer)[1:])\r\n\t# num_features = layer_shape[1:].num_elements()\r\n\r\n\tnum_features = 8 * 8 * 128\r\n\tlayer_flat = tf.reshape(layer, [-1, num_features])\r\n\r\n\treturn layer_flat, num_features\r\n```\r\nManually calculate the `num_features` and change:  \r\n `pool3_flat, pool3_size = Flatten(pool3)`    \r\ninto      \r\n`pool3_flat, pool3_size = Flatten_test(pool3)`      \r\n\r\nFinally, I can successfully run the `main.py`.        \r\n\r\nHowever, I still puzzle about why the `num_features ` is None in `Flatten()`\r\n"}}
{"actor":{"display_login":"LiChenyang-Github"}}