T-Almeida / tensorflow-keras-multidimensional-rnn

Multidimensional RNN in Keras Tensorflow
Apache License 2.0
20 stars 2 forks source link

ctc function #5

Closed Zrufy closed 4 years ago

Zrufy commented 4 years ago

hello I'm trying to use MDLSTM with the ctc+crnn function but without success it causes an error by the loss ctc.

def ctc_func(args):
    y_pred, labels, input_length, label_length = args
    y_pred = y_pred[:, 2:, :]
    return K.ctc_batch_cost(labels, y_pred, input_length, label_length)

the error is: ValueError: Index out of range using input dim 2; input has only 2 dims for 'ctc/strided_slice' (op: 'StridedSlice') with input shapes: [?,37], [3], [3], [3] and with computed input tensors: input[3] = <1 1 1>.

I use this example on the notebook to start for this layer

Have you any suggestion?

T-Almeida commented 4 years ago

Hi,

Could you give me a more complete code snippet for reproducing the problem, since I never worked with ctc_cost function?

From this snippet, it seems that the problem is unrelated to the MD layer since I am not seeing any reference to it. Furthermore, any normal tf.Keras code SHOULD work with this type of layer since its API is followed (without masking for now)