{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/7751","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/7751/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/7751/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/7751/events","html_url":"https://github.com/tensorflow/tensorflow/issues/7751","id":209280450,"number":7751,"title":"tf.contrib.crf doesn't support sequences of length 1","user":{"login":"Franck-Dernoncourt","id":15331,"avatar_url":"https://avatars.githubusercontent.com/u/15331?v=3","gravatar_id":"","url":"https://api.github.com/users/Franck-Dernoncourt","html_url":"https://github.com/Franck-Dernoncourt","followers_url":"https://api.github.com/users/Franck-Dernoncourt/followers","following_url":"https://api.github.com/users/Franck-Dernoncourt/following{/other_user}","gists_url":"https://api.github.com/users/Franck-Dernoncourt/gists{/gist_id}","starred_url":"https://api.github.com/users/Franck-Dernoncourt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Franck-Dernoncourt/subscriptions","organizations_url":"https://api.github.com/users/Franck-Dernoncourt/orgs","repos_url":"https://api.github.com/users/Franck-Dernoncourt/repos","events_url":"https://api.github.com/users/Franck-Dernoncourt/events{/privacy}","received_events_url":"https://api.github.com/users/Franck-Dernoncourt/received_events","type":"User","site_admin":false},"labels":[{"id":473172988,"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/type:bug/performance","name":"type:bug/performance","color":"fbca04","default":false},{"id":473184161,"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/type:support","name":"type:support","color":"b60205","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-02-21T21:37:44Z","updated_at":"2017-02-22T19:11:39Z","closed_at":null,"body":"[`tf.contrib.crf`](https://www.tensorflow.org/versions/master/api_docs/python/contrib.crf/) doesn't support sequences of length 1.\r\n\r\nFor example, if I run the example on https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/crf and replace `num_words = 20` by `num_words = 1`, I get the error:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\client\\session.py\", line 1022, in _do_call\r\n    return fn(*args)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\client\\session.py\", line 1004, in _run_fn\r\n    status, run_metadata)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\contextlib.py\", line 66, in __exit__\r\n    next(self.gen)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\framework\\errors_impl.py\", line 469, in raise_exception_on_not_ok_status\r\n    pywrap_tensorflow.TF_GetCode(status))\r\ntensorflow.python.framework.errors_impl.UnimplementedError: TensorArray has size zero, but element shape <unknown> is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays.\r\n\t [[Node: gradients/rnn/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGatherV3 = TensorArrayGatherV3[_class=[\"loc:@rnn/TensorArray_1\"], dtype=DT_FLOAT, element_shape=<unknown>, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](gradients/rnn/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGrad/TensorArrayGradV3, rnn/TensorArrayUnstack/range, gradients/rnn/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGrad/gradient_flow)]]\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"C:\\Users\\Francky\\Documents\\GitHub\\nlp\\neurodeid\\test\\CRF_v2.py\", line 47, in <module>\r\n    [unary_scores, transition_params, train_op])\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\client\\session.py\", line 767, in run\r\n    run_metadata_ptr)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\client\\session.py\", line 965, in _run\r\n    feed_dict_string, options, run_metadata)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\client\\session.py\", line 1015, in _do_run\r\n    target_list, options, run_metadata)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\client\\session.py\", line 1035, in _do_call\r\n    raise type(e)(node_def, op, message)\r\ntensorflow.python.framework.errors_impl.UnimplementedError: TensorArray has size zero, but element shape <unknown> is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays.\r\n\t [[Node: gradients/rnn/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGatherV3 = TensorArrayGatherV3[_class=[\"loc:@rnn/TensorArray_1\"], dtype=DT_FLOAT, element_shape=<unknown>, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](gradients/rnn/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGrad/TensorArrayGradV3, rnn/TensorArrayUnstack/range, gradients/rnn/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGrad/gradient_flow)]]\r\n\r\nCaused by op 'gradients/rnn/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGatherV3', defined at:\r\n  File \"C:\\Users\\Francky\\Documents\\GitHub\\nlp\\neurodeid\\test\\CRF_v2.py\", line 41, in <module>\r\n    train_op = tf.train.GradientDescentOptimizer(0.01).minimize(loss)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\training\\optimizer.py\", line 288, in minimize\r\n    grad_loss=grad_loss)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\training\\optimizer.py\", line 354, in compute_gradients\r\n    colocate_gradients_with_ops=colocate_gradients_with_ops)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\gradients_impl.py\", line 482, in gradients\r\n    in_grads = grad_fn(op, *out_grads)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\tensor_array_grad.py\", line 186, in _TensorArrayScatterGrad\r\n    grad = g.gather(indices)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\tensor_array_ops.py\", line 348, in gather\r\n    element_shape=element_shape)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\gen_data_flow_ops.py\", line 2226, in _tensor_array_gather_v3\r\n    element_shape=element_shape, name=name)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\framework\\op_def_library.py\", line 763, in apply_op\r\n    op_def=op_def)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\framework\\ops.py\", line 2395, in create_op\r\n    original_op=self._default_original_op, op_def=op_def)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\framework\\ops.py\", line 1264, in __init__\r\n    self._traceback = _extract_stack()\r\n\r\n...which was originally created as op 'rnn/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3', defined at:\r\n  File \"C:\\Users\\Francky\\Documents\\GitHub\\nlp\\neurodeid\\test\\CRF_v2.py\", line 37, in <module>\r\n    unary_scores, y_t, sequence_lengths_t)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\contrib\\crf\\python\\ops\\crf.py\", line 156, in crf_log_likelihood\r\n    log_norm = crf_log_norm(inputs, sequence_lengths, transition_params)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\contrib\\crf\\python\\ops\\crf.py\", line 123, in crf_log_norm\r\n    dtype=dtypes.float32)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\rnn.py\", line 545, in dynamic_rnn\r\n    dtype=dtype)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\rnn.py\", line 663, in _dynamic_rnn_loop\r\n    for ta, input_ in zip(input_ta, flat_input))\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\rnn.py\", line 663, in <genexpr>\r\n    for ta, input_ in zip(input_ta, flat_input))\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\tensor_array_ops.py\", line 400, in unstack\r\n    indices=math_ops.range(0, num_elements), value=value, name=name)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\tensor_array_ops.py\", line 428, in scatter\r\n    name=name)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\gen_data_flow_ops.py\", line 2492, in _tensor_array_scatter_v3\r\n    name=name)\r\n  File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\framework\\op_def_library.py\", line 763, in apply_op\r\n    op_def=op_def)\r\n\r\nUnimplementedError (see above for traceback): TensorArray has size zero, but element shape <unknown> is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays.\r\n\t [[Node: gradients/rnn/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGatherV3 = TensorArrayGatherV3[_class=[\"loc:@rnn/TensorArray_1\"], dtype=DT_FLOAT, element_shape=<unknown>, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](gradients/rnn/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGrad/TensorArrayGradV3, rnn/TensorArrayUnstack/range, gradients/rnn/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGrad/gradient_flow)]]\r\n```\r\n\r\nTested with TensorFlow 1.0.0 on Windows 7 SP1 x64 Ultimate and TensorFlow-GPU 1.0.0 on Ubuntu 14.04.4 LTS x64."},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/281770324","html_url":"https://github.com/tensorflow/tensorflow/issues/7751#issuecomment-281770324","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/7751","id":281770324,"user":{"login":"poxvoculi","id":15676913,"avatar_url":"https://avatars.githubusercontent.com/u/15676913?v=3","gravatar_id":"","url":"https://api.github.com/users/poxvoculi","html_url":"https://github.com/poxvoculi","followers_url":"https://api.github.com/users/poxvoculi/followers","following_url":"https://api.github.com/users/poxvoculi/following{/other_user}","gists_url":"https://api.github.com/users/poxvoculi/gists{/gist_id}","starred_url":"https://api.github.com/users/poxvoculi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poxvoculi/subscriptions","organizations_url":"https://api.github.com/users/poxvoculi/orgs","repos_url":"https://api.github.com/users/poxvoculi/repos","events_url":"https://api.github.com/users/poxvoculi/events{/privacy}","received_events_url":"https://api.github.com/users/poxvoculi/received_events","type":"User","site_admin":false},"created_at":"2017-02-22T19:11:39Z","updated_at":"2017-02-22T19:11:39Z","body":"This appears to be an unmaintained contrib utility.  Would you like to propose a fix?"}}
{"actor":{"display_login":"poxvoculi"}}