CTC 损失计算错误

问题描述

Python 的输入:

sequence1 = [0,1] 
output1 = [[1,0],[0,1,0]]
loss = tf.compat.v1.nn.ctc_loss(
                               labels=tf.sparse.from_dense([sequence1]),inputs=np.array([output1]).astype('float32'),sequence_length=[2],time_major = False
                               )
print(loss.numpy())

Python 的输出

array([1.2408944],dtype=float32)

Mathematica 的输入:

CTCLossLayer[<|
   "Input" -> {{1,0},{0,0}},"Target" -> {1,2} (* Index starts from 1 and not 0 *)
|>]

Mathematica 的输出

0.

因为我的序列是 [0,1] 并且它是一种热编码(当字符数为 2 + 1(对于 CTC)时)是 [[1,0]] - nn.ctc_loss 不应该是 {{ 1}}?就像在 Mathematica 中一样?谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)