Keras CTCBeamSearchDecoder认为形状(2,)的序列长度不是向量

Keras CTCBeamSearchDecoder认为形状(2,)的序列长度不是向量,keras,ctc,Keras,Ctc,尝试在Keras模型中运行波束搜索时,我会收到令人困惑(并且相互冲突?)的错误消息。我的模型有如下输入: inputs = Input(name='spectrograms', shape=(None, hparams["n_spectrogram"])) input_length = Input(name='len_spectrograms', shape=[1], dtype='int64') CTC丢失函数需要输入和

尝试在Keras模型中运行波束搜索时,我会收到令人困惑(并且相互冲突?)的错误消息。我的模型有如下输入:

inputs = Input(name='spectrograms',
               shape=(None, hparams["n_spectrogram"]))
input_length = Input(name='len_spectrograms',
                     shape=[1], dtype='int64')
CTC丢失函数需要输入和标签长度的
[1]
形状。据我所知,输出应该通过以下方式获得

# Stick connectionist temporal classification on the end of the core model
paths = K.function(
    [inputs, input_length],
    K.ctc_decode(output, input_length, greedy=False, top_paths=4)[0])
但实际上,这导致了人们对
input\u length

ValueError: Shape must be rank 1 but is rank 2 for 'CTCBeamSearchDecoder' (op: 'CTCBeamSearchDecoder') with input shapes: [?,?,44], [?,1].
但如果我砍掉那个维度

    K.ctc_decode(output, input_length[..., 0], greedy=False, top_paths=4)[0])
模型定义会运行,但是当我运行
y=path([x,numpy.array([30],[30]]))
时,我突然得到一个
x.shape==(2,30,513)

tensorflow.python.framework.errors_impl.InvalidArgumentError: sequence_length is not a vector
     [[{{node CTCBeamSearchDecoder}} = CTCBeamSearchDecoder[beam_width=100, merge_repeated=true, top_paths=4, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Log, ToInt32)]]
我做错了什么