ImportError:无法使用TensorFlow深度学习合作伙伴导入名称'maxpool_2d'

时间:2019-06-10 12:32:04

标签: tensorflow google-colaboratory

我是从事猫和狗分类器的初学者。我的代码如下:

import tflearn
from tflearn.layers.conv import conv_2d,maxpool_2d
convnet=conv_2d(convent,32,5,activation='relu')
convent=max_pool_2d(convent,5)

在google colab中运行此程序时,出现以下错误。请帮忙。

    ImportError                               
    <ipython-input-8-dc6c9fb9359a> in <module>()
      1 
      2 import tflearn
----> 3 from tflearn.layers.conv import conv_2d,maxpool_2d

     ImportError: cannot import name 'maxpool_2d'
     NameError                                 
     <ipython-input-64-4f4aec72da8c> in <module>()
----> 1 convnet=conv_2d(convent,32,5,activation='relu')
      2 convent=max_pool_2d(convent,5)
    NameError: name 'convent' is not defined
    NameError                                
    <ipython-input-4-be31c35783ac> in <module>()
----> 1 convnet = conv_2d(convnet, 64, 5, activation='relu')
      2 convent=max_pool_2d(convent,5)
    NameError: name 'conv_2d' is not defined

1 个答案:

答案 0 :(得分:0)

  1. 应为max_pool_2d,而不是maxpool_2d
  2. 您将convnet设置为传入张量参数,但未提前声明。