AttributeError: module 'theano' has no attribute 'ifelse'

keras的后台问题。

因为模型要求是th后台,我觉得只要transpose不就好了,后来发现坑还挺大,不是那么容易。

出现了上面的错误,

    x = BatchNormalization(axis=freq_axis, name='bn_0_freq')(melgram_input)
  File "D:\python36\lib\site-packages\keras\engine\topology.py", line 569, in __call__
    self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
  File "D:\python36\lib\site-packages\keras\engine\topology.py", line 632, in add_inbound_node
    Node.create_node(self, inbound_layers, node_indices, tensor_indices)
  File "D:\python36\lib\site-packages\keras\engine\topology.py", line 164, in create_node
    output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
  File "D:\python36\lib\site-packages\keras\layers\normalization.py", line 140, in call
    x_normed = K.in_train_phase(x_normed, x_normed_running)
  File "D:\python36\lib\site-packages\keras\backend\theano_backend.py", line 1120, in in_train_phase
    x = theano.ifelse.ifelse(_LEARNING_PHASE, x, alt)
AttributeError: module 'theano' has no attribute 'ifelse'

搜索到了结果,直接引入即可,有点像librosa的display,在报错的文件中import。

另外有相关问题可以加入QQ群讨论,不设微信群

QQ群:868373192 

语音图像视频深度-学习群

发布了240 篇原创文章 · 获赞 233 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/SPESEG/article/details/105168641