question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError in CTCLoss

See original GitHub issue

Ubuntu 14.

python train.py results in :

INFO:tensorflow:0228:18:35:26.811:data.py:73] VCTK corpus loaded.(total data=36395, total batch=2274)                         
Traceback (most recent call last):                            
  File "train.py", line 79, in <module>                               
    loss = logit.sg_ctc(target=y, seq_len=seq_len)
  File "/home/gvoysey/.local/share/virtualenvs/speech-to-text-wavenet/local/lib/python2.7/site-packages/sugartensor/sg_main.py", line 151, in wrapper                         
    out = func(tensor, tf.sg_opt(kwargs))       
  File "/home/gvoysey/.local/share/virtualenvs/speech-to-text-wavenet/local/lib/python2.7/site-packages/sugartensor/sg_loss.py", line 226, in sg_ctc                          
    ctc_merge_repeated=opt.merge, time_major=False)                                           
  File "/home/gvoysey/.local/share/virtualenvs/speech-to-text-wavenet/local/lib/python2.7/site-packages/tensorflow/python/ops/ctc_ops.py", line 145, in ctc_loss              
    ctc_merge_repeated=ctc_merge_repeated)    
  File "/home/gvoysey/.local/share/virtualenvs/speech-to-text-wavenet/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_ctc_ops.py", line 164, in _ctc_loss         
    name=name)        
  File "/home/gvoysey/.local/share/virtualenvs/speech-to-text-wavenet/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op 
    op_def=op_def)    
  File "/home/gvoysey/.local/share/virtualenvs/speech-to-text-wavenet/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2397, in create_op          
    set_shapes_for_outputs(ret)               
  File "/home/gvoysey/.local/share/virtualenvs/speech-to-text-wavenet/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1757, in set_shapes_for_outputs   
    shapes = shape_func(op)                       
  File "/home/gvoysey/.local/share/virtualenvs/speech-to-text-wavenet/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1707, in call_with_requiring
    return call_cpp_shape_fn(op, require_shape_fn=True)                                               
  File "/home/gvoysey/.local/share/virtualenvs/speech-to-text-wavenet/local/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 610, in call_cpp_shape_fn       
    debug_python_shape_fn, require_shape_fn)  
  File "/home/gvoysey/.local/share/virtualenvs/speech-to-text-wavenet/local/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 675, in _call_cpp_shape_fn_impl 
    raise ValueError(err.message)             
ValueError: Shape must be rank 1 but is rank 0 for 'CTCLoss' (op: 'CTCLoss') with input shapes: [?,16,28], [?,2], [?], [].        

Any ideas?

tensorflow version 1.0.0
sugartensor version 1.0.0.1

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9

github_iconTop GitHub Comments

4reactions
Kyubyongcommented, Mar 10, 2017

Try replacing dims with axis in line 35 of train.py if you are using TF 1.0. The argument name dims has changed to axis in many functions.

seq_len = tf.not_equal(x.sg_sum(dims=2), 0.).sg_int().sg_sum(dims=1)

0reactions
gvoyseycommented, Aug 19, 2017

is this still relevant?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ValueError in CTCLoss · Issue #12957 · tensorflow ... - GitHub
This question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that...
Read more >
Developers - ValueError in CTCLoss - - Bountysource
ValueError in CTCLoss. ... ValueError: Shape must be rank 1 but is rank 0 for 'CTCLoss' (op: 'CTCLoss') with input shapes: [?,16,28], [?,2],...
Read more >
ValueError: Exception encountered when calling layer "ctc_loss"
Tensorflow Beginner here. I got this error message and I have no clue what to do, where to look or what to change?...
Read more >
Keras Lambda Layers not supported for CTC Loss
I am looking to implement CTC loss function within CoreML. I tried, as a starting point, ... ValueError: Keras layer '<class 'keras.layers.core.
Read more >
Python Examples of warpctc_pytorch.CTCLoss
This page shows Python examples of warpctc_pytorch.CTCLoss. ... CTCLoss(size_average=True, reduce=reduce) else: raise ValueError( 'ctc_type must be ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found