【问题标题】:ImportError: cannot import name 'maxpool_2d' with TensorFlow deep learning colabImportError:无法使用 TensorFlow 深度学习 colab 导入名称“maxpool_2d”
【发布时间】:2019-10-24 20:40:29
【问题描述】:

我是一名研究猫狗分类器的初学者。我的代码如下:

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

【问题讨论】:

    标签: tensorflow google-colaboratory


    【解决方案1】:
    1. 应该是max_pool_2d 而不是maxpool_2d
    2. 您将 convnet 设置为传入张量参数,但之前未声明。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-24
    • 1970-01-01
    • 2021-08-27
    • 2022-12-25
    • 1970-01-01
    • 2019-01-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多