{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/21799","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/21799/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/21799/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/21799/events","html_url":"https://github.com/tensorflow/tensorflow/issues/21799","id":352955784,"node_id":"MDU6SXNzdWUzNTI5NTU3ODQ=","number":21799,"title":"Keras.fit fails when using tf.data.Datasets with sparse labels","user":{"login":"dlfelps","id":12205131,"node_id":"MDQ6VXNlcjEyMjA1MTMx","avatar_url":"https://avatars1.githubusercontent.com/u/12205131?v=4","gravatar_id":"","url":"https://api.github.com/users/dlfelps","html_url":"https://github.com/dlfelps","followers_url":"https://api.github.com/users/dlfelps/followers","following_url":"https://api.github.com/users/dlfelps/following{/other_user}","gists_url":"https://api.github.com/users/dlfelps/gists{/gist_id}","starred_url":"https://api.github.com/users/dlfelps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlfelps/subscriptions","organizations_url":"https://api.github.com/users/dlfelps/orgs","repos_url":"https://api.github.com/users/dlfelps/repos","events_url":"https://api.github.com/users/dlfelps/events{/privacy}","received_events_url":"https://api.github.com/users/dlfelps/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"robieta","id":13089297,"node_id":"MDQ6VXNlcjEzMDg5Mjk3","avatar_url":"https://avatars0.githubusercontent.com/u/13089297?v=4","gravatar_id":"","url":"https://api.github.com/users/robieta","html_url":"https://github.com/robieta","followers_url":"https://api.github.com/users/robieta/followers","following_url":"https://api.github.com/users/robieta/following{/other_user}","gists_url":"https://api.github.com/users/robieta/gists{/gist_id}","starred_url":"https://api.github.com/users/robieta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robieta/subscriptions","organizations_url":"https://api.github.com/users/robieta/orgs","repos_url":"https://api.github.com/users/robieta/repos","events_url":"https://api.github.com/users/robieta/events{/privacy}","received_events_url":"https://api.github.com/users/robieta/received_events","type":"User","site_admin":false},"assignees":[{"login":"robieta","id":13089297,"node_id":"MDQ6VXNlcjEzMDg5Mjk3","avatar_url":"https://avatars0.githubusercontent.com/u/13089297?v=4","gravatar_id":"","url":"https://api.github.com/users/robieta","html_url":"https://github.com/robieta","followers_url":"https://api.github.com/users/robieta/followers","following_url":"https://api.github.com/users/robieta/following{/other_user}","gists_url":"https://api.github.com/users/robieta/gists{/gist_id}","starred_url":"https://api.github.com/users/robieta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robieta/subscriptions","organizations_url":"https://api.github.com/users/robieta/orgs","repos_url":"https://api.github.com/users/robieta/repos","events_url":"https://api.github.com/users/robieta/events{/privacy}","received_events_url":"https://api.github.com/users/robieta/received_events","type":"User","site_admin":false},{"login":"omalleyt12","id":29100818,"node_id":"MDQ6VXNlcjI5MTAwODE4","avatar_url":"https://avatars3.githubusercontent.com/u/29100818?v=4","gravatar_id":"","url":"https://api.github.com/users/omalleyt12","html_url":"https://github.com/omalleyt12","followers_url":"https://api.github.com/users/omalleyt12/followers","following_url":"https://api.github.com/users/omalleyt12/following{/other_user}","gists_url":"https://api.github.com/users/omalleyt12/gists{/gist_id}","starred_url":"https://api.github.com/users/omalleyt12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omalleyt12/subscriptions","organizations_url":"https://api.github.com/users/omalleyt12/orgs","repos_url":"https://api.github.com/users/omalleyt12/repos","events_url":"https://api.github.com/users/omalleyt12/events{/privacy}","received_events_url":"https://api.github.com/users/omalleyt12/received_events","type":"User","site_admin":false}],"milestone":null,"comments":7,"created_at":"2018-08-22T13:33:26Z","updated_at":"2018-09-28T16:41:21Z","closed_at":null,"author_association":"NONE","body":"\r\n### System information\r\n- **Have I written custom code (as opposed to using a stock example script provided in TensorFlow)**: yes\r\n- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: Windows 10\r\n- **Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device**: N/A\r\n- **TensorFlow installed from (source or binary)**: binary\r\n- **TensorFlow version (use command below)**: r1.10\r\n- **Python version**: 3.6.5\r\n- **Bazel version (if compiling from source)**: N/A\r\n- **GCC/Compiler version (if compiling from source)**: N/A\r\n- **CUDA/cuDNN version**: 5.2\r\n- **GPU model and memory**: NVIDIA TITAN X\r\n- **Exact command to reproduce**: See below\r\n\r\n### Describe the problem\r\nKeras model.fit function now accepts tf.data.Datasets as an argument, however sparse output labels cause an error. \r\n\r\n### Source code / logs\r\n\r\n1. Build a custom Keras model:\r\nmodel = tf.keras.applications.MobileNet(weights=None, include_top=True, input_shape=(32,32,3), classes=100)\r\n\r\n2. Compile with 'sparse_categorical_crossentropy':\r\nmodel.compile(optimizer='sgd', loss='sparse_categorical_crossentropy',     metrics=['accuracy'])\r\n\r\n3. This model will train successfully if passed a numpy array pair (x, sparse_y), but fails when this is wrapped in tf.data.Dataset interface. See traceback below:\r\n\r\n  File \"C:\\PycharmProjects\\mi_exp\\.venv\\lib\\site-packages\\tensorflow\\python\\keras\\engine\\training.py\", line 1278, in fit\r\n    validation_split=validation_split)\r\n  File \"C:\\PycharmProjects\\mi_exp\\.venv\\lib\\site-packages\\tensorflow\\python\\keras\\engine\\training.py\", line 917, in _standardize_user_data\r\n    exception_prefix='target')\r\n  File \"C:\\PycharmProjects\\mi_exp\\.venv\\lib\\site-packages\\tensorflow\\python\\keras\\engine\\training_utils.py\", line 182, in standardize_input_data\r\n    'with shape ' + str(data_shape))\r\nValueError: Error when checking target: expected reshape_2 to have 2 dimensions, but got array with shape (None,)\r\n"},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/425495259","html_url":"https://github.com/tensorflow/tensorflow/issues/21799#issuecomment-425495259","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/21799","id":425495259,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTQ5NTI1OQ==","user":{"login":"omalleyt12","id":29100818,"node_id":"MDQ6VXNlcjI5MTAwODE4","avatar_url":"https://avatars3.githubusercontent.com/u/29100818?v=4","gravatar_id":"","url":"https://api.github.com/users/omalleyt12","html_url":"https://github.com/omalleyt12","followers_url":"https://api.github.com/users/omalleyt12/followers","following_url":"https://api.github.com/users/omalleyt12/following{/other_user}","gists_url":"https://api.github.com/users/omalleyt12/gists{/gist_id}","starred_url":"https://api.github.com/users/omalleyt12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omalleyt12/subscriptions","organizations_url":"https://api.github.com/users/omalleyt12/orgs","repos_url":"https://api.github.com/users/omalleyt12/repos","events_url":"https://api.github.com/users/omalleyt12/events{/privacy}","received_events_url":"https://api.github.com/users/omalleyt12/received_events","type":"User","site_admin":false},"created_at":"2018-09-28T16:41:21Z","updated_at":"2018-09-28T16:41:21Z","author_association":"NONE","body":"@maksym33 make sure you're batching your data, if you still see an error can you reply with a simple code snippet that reproduces?"}}
{"actor":{"display_login":"omalleyt12"}}