tensorflow中文语音识别求教程序错误

weixin_40146147 2018-05-08 03:24:01

加载训练样本: 2018-05-08 15:23:59
样本数: 215
词汇表大小: 356
最长句子的字数: 63
最长的语音: 577
开始训练: 2018-05-08 15:25:51
Traceback (most recent call last):

File "<ipython-input-26-aee84d4c319a>", line 1, in <module>
runfile('/home/liujuanhong/data/mfcccnn.py', wdir='/home/liujuanhong/data')

File "/usr/lib/python3/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)

File "/usr/lib/python3/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 88, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)

File "/home/liujuanhong/data/mfcccnn.py", line 329, in <module>
train_speech_to_text_network()

File "/home/liujuanhong/data/mfcccnn.py", line 293, in train_speech_to_text_network
logit = speech_to_text_network()

File "/home/liujuanhong/data/mfcccnn.py", line 153, in speech_to_text_network
out, s = residual_block(out, size=7, rate=r)#根据采样频率发生变化

File "/home/liujuanhong/data/mfcccnn.py", line 144, in residual_block
conv_filter = aconv1d_layer(input_sensor, size=size, rate=rate, activation='tanh', scale=0.03, bias=False)

File "/home/liujuanhong/data/mfcccnn.py", line 235, in aconv1d_layer
mean, variance = tf.nn.moments(out, axes=range(len(out.get_shape()) - 1))

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/nn_impl.py", line 690, in moments
mean = math_ops.reduce_mean(y, axes, keepdims=True, name="mean")

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 432, in new_func
return func(*args, **kwargs)

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/math_ops.py", line 1549, in reduce_mean
name=name))

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_math_ops.py", line 4425, in mean
name=name)

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 528, in _apply_op_helper
(input_name, err))

ValueError: Tried to convert 'reduction_indices' to a tensor and failed. Error: Argument must be a dense tensor: range(0, 2) - got shape [2], but wanted [].
请问这个错误的原因是什么?怎么解决???
...全文
799 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
爱抓猫的狗 2018-05-08
  • 打赏
  • 举报
回复
File "/home/liujuanhong/data/mfcccnn.py", line 144, in residual_block conv_filter = aconv1d_layer(input_sensor, size=size, rate=rate, activation='tanh', scale=0.03, bias=False) 中的input_sensor应该是要求字符串吧,你给了个2维数组? 报错信息应该是这个地方,好好查一查

37,720

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧