{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/19260","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/19260/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/19260/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/19260/events","html_url":"https://github.com/tensorflow/tensorflow/issues/19260","id":322635122,"number":19260,"title":"[Lite] TOCO tool might not handle negative indices correctly","user":{"login":"Androbin","id":16437156,"avatar_url":"https://avatars1.githubusercontent.com/u/16437156?v=4","gravatar_id":"","url":"https://api.github.com/users/Androbin","html_url":"https://github.com/Androbin","followers_url":"https://api.github.com/users/Androbin/followers","following_url":"https://api.github.com/users/Androbin/following{/other_user}","gists_url":"https://api.github.com/users/Androbin/gists{/gist_id}","starred_url":"https://api.github.com/users/Androbin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Androbin/subscriptions","organizations_url":"https://api.github.com/users/Androbin/orgs","repos_url":"https://api.github.com/users/Androbin/repos","events_url":"https://api.github.com/users/Androbin/events{/privacy}","received_events_url":"https://api.github.com/users/Androbin/received_events","type":"User","site_admin":false},"labels":[{"id":750616506,"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/comp:lite","name":"comp:lite","color":"e99695","default":false},{"id":404586594,"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/stat:awaiting%20tensorflower","name":"stat:awaiting tensorflower","color":"b60205","default":false}],"state":"open","locked":false,"assignee":{"login":"rryan","id":26527,"avatar_url":"https://avatars3.githubusercontent.com/u/26527?v=4","gravatar_id":"","url":"https://api.github.com/users/rryan","html_url":"https://github.com/rryan","followers_url":"https://api.github.com/users/rryan/followers","following_url":"https://api.github.com/users/rryan/following{/other_user}","gists_url":"https://api.github.com/users/rryan/gists{/gist_id}","starred_url":"https://api.github.com/users/rryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rryan/subscriptions","organizations_url":"https://api.github.com/users/rryan/orgs","repos_url":"https://api.github.com/users/rryan/repos","events_url":"https://api.github.com/users/rryan/events{/privacy}","received_events_url":"https://api.github.com/users/rryan/received_events","type":"User","site_admin":false},"assignees":[{"login":"rryan","id":26527,"avatar_url":"https://avatars3.githubusercontent.com/u/26527?v=4","gravatar_id":"","url":"https://api.github.com/users/rryan","html_url":"https://github.com/rryan","followers_url":"https://api.github.com/users/rryan/followers","following_url":"https://api.github.com/users/rryan/following{/other_user}","gists_url":"https://api.github.com/users/rryan/gists{/gist_id}","starred_url":"https://api.github.com/users/rryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rryan/subscriptions","organizations_url":"https://api.github.com/users/rryan/orgs","repos_url":"https://api.github.com/users/rryan/repos","events_url":"https://api.github.com/users/rryan/events{/privacy}","received_events_url":"https://api.github.com/users/rryan/received_events","type":"User","site_admin":false},{"login":"alanchiao","id":4323109,"avatar_url":"https://avatars2.githubusercontent.com/u/4323109?v=4","gravatar_id":"","url":"https://api.github.com/users/alanchiao","html_url":"https://github.com/alanchiao","followers_url":"https://api.github.com/users/alanchiao/followers","following_url":"https://api.github.com/users/alanchiao/following{/other_user}","gists_url":"https://api.github.com/users/alanchiao/gists{/gist_id}","starred_url":"https://api.github.com/users/alanchiao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alanchiao/subscriptions","organizations_url":"https://api.github.com/users/alanchiao/orgs","repos_url":"https://api.github.com/users/alanchiao/repos","events_url":"https://api.github.com/users/alanchiao/events{/privacy}","received_events_url":"https://api.github.com/users/alanchiao/received_events","type":"User","site_admin":false}],"milestone":null,"comments":13,"created_at":"2018-05-13T23:06:04Z","updated_at":"2018-05-22T00:51:34Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### System information\r\n- **Have I written custom code**: yes\r\n- **OS Platform and Distribution**: Ubuntu 16.04.2 LTS\r\n- **TensorFlow installed from**: source\r\n- **TensorFlow version**: v1.8.0-1520-g1f03f82 1.8.0\r\n- **Python version**: 3.5.2\r\n- **Bazel version**: 0.13.0\r\n\r\n### Problem\r\nI tried using the [TOCO tool](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/toco) on a graph that contains a [`strided_slice`](https://www.tensorflow.org/api_docs/python/tf/strided_slice) op.\r\nThe code determining the fixed size of this op, fails at an assertion and throws an error (see below).\r\n\r\n### Logs\r\n2018-05-14 00:42:56.816500: F [tensorflow/contrib/lite/toco/graph_transformations/propagate_fixed_sizes.cc:1305](https://github.com/tensorflow/tensorflow/blob/1f03f829285ca0fbd47a99350e9f5d99aa10e9b9/tensorflow/contrib/lite/toco/graph_transformations/propagate_fixed_sizes.cc#L1305)] Check failed: dim_size > 0 (-1 vs. 0)Output size for an axis must be greater than 0. Axis 0 computes to size -1 for StridedSlice op with output \"stft/frame/strided_slice\".\r\n\r\n### Minimum Reproducible Example\r\n[Source files](https://github.com/tensorflow/tensorflow/files/1999035/mre.zip)\r\n(set `TF_ROOT` in `freeze` and `toco`)\r\n```\r\n./mre.py\r\n./freeze\r\n./toco\r\n```\r\nThis produces a directory \"model\" with the graph, weights and frozen graph.\r\nThe offending error is thrown by last step."},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/390828606","html_url":"https://github.com/tensorflow/tensorflow/issues/19260#issuecomment-390828606","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/19260","id":390828606,"user":{"login":"alanchiao","id":4323109,"avatar_url":"https://avatars2.githubusercontent.com/u/4323109?v=4","gravatar_id":"","url":"https://api.github.com/users/alanchiao","html_url":"https://github.com/alanchiao","followers_url":"https://api.github.com/users/alanchiao/followers","following_url":"https://api.github.com/users/alanchiao/following{/other_user}","gists_url":"https://api.github.com/users/alanchiao/gists{/gist_id}","starred_url":"https://api.github.com/users/alanchiao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alanchiao/subscriptions","organizations_url":"https://api.github.com/users/alanchiao/orgs","repos_url":"https://api.github.com/users/alanchiao/repos","events_url":"https://api.github.com/users/alanchiao/events{/privacy}","received_events_url":"https://api.github.com/users/alanchiao/received_events","type":"User","site_admin":false},"created_at":"2018-05-22T00:51:34Z","updated_at":"2018-05-22T00:51:34Z","author_association":"MEMBER","body":"I think it should be the call to [tf.strided_slice]( https://github.com/tensorflow/tensorflow/blob/r1.4/tensorflow/contrib/signal/python/ops/shape_ops.py#L161) instead.\r\n\r\nThe pbtxt file shows the name \"stft/frame/strided_slice\" attached to a StridedSlice operator and there isn't any other StridedSlice op in the pbtxt file.\r\n\r\nThis is [what Tensorboard shows for the frozen graph](https://user-images.githubusercontent.com/4323109/40336477-a3d89a88-5d1e-11e8-834f-7e11e32cc625.png) and we can see the output feeds into the reshape op, matching the code.\r\n\r\n```\r\n    subframes = array_ops.reshape(array_ops.strided_slice(\r\n        signal, array_ops.zeros_like(signal_shape),\r\n        slice_shape), subframe_shape)\r\n```\r\n\r\nThe **subframes** variable (output of reshape) then feeds into a GatherV2 op, which matches the code below.\r\n\r\n```\r\nframes = array_ops.reshape(\r\n        array_ops.gather(subframes, selector, axis=axis),\r\n        array_ops.concat([outer_dimensions, [num_frames, frame_length],\r\n                          inner_dimensions], 0)) \r\n```\r\n\r\n\r\n"}}
{"actor":{"display_login":"alanchiao"}}