东方耀AI技术分享

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 5648|回复: 1
打印 上一主题 下一主题

[课堂笔记] AttributeError: 'Tensor' object has no attribute '_keras_shape'

[复制链接]

1365

主题

1856

帖子

1万

积分

管理员

Rank: 10Rank: 10Rank: 10

积分
14432
QQ
跳转到指定楼层
楼主
发表于 2020-8-20 15:14:28 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
AttributeError: 'Tensor' object has no attribute '_keras_shape'

https://www.tensorflow.org/api_docs/python/tf/keras

_keras_shape换成_shape_val即可


输入的特征图: <class 'tensorflow.python.framework.ops.Tensor'>

input_feature_map.__dict__ 打印python对象的所有属性


{'_op': <tf.Operation 'boxes4/BiasAdd' type=BiasAdd>,

'_value_ind '_dtype': tf.float32,

'_tf_output': <tensorflow.python.pywrap_tensorflow_internal.TF_Output;


proxy of <Swig Object of type 'TF_Output *' at 0x7fb946da1360> >,


'_shape_val': TensorShape([Dimension(None), Dimension(37), Dimension(60), Dimension(24)]),


'_consumers': [], '_id': 825, '_name': None,


'_keras_history': KerasHistory(layer=<tensorflow.python.keras.layers.convolutional.Conv2D object at 0x7fb946d8e2e8>,


node_index=0, tensor_index=0), '_keras_mask': None}





tf.keras中的.png (106.72 KB, 下载次数: 123)

tf.keras中的.png
让天下人人学会人工智能!人工智能的前景一片大好!
回复

使用道具 举报

1365

主题

1856

帖子

1万

积分

管理员

Rank: 10Rank: 10Rank: 10

积分
14432
QQ
沙发
 楼主| 发表于 2020-8-20 15:25:25 | 只看该作者
print("这是什么类型:", feature_map_height, type(feature_map_height))
            feature_map_height = int(feature_map_height)
            feature_map_width = int(feature_map_width)
            feature_map_channels = int(feature_map_channels)
            # <class 'tensorflow.python.framework.tensor_shape.Dimension'>
让天下人人学会人工智能!人工智能的前景一片大好!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|人工智能工程师的摇篮 ( 湘ICP备2020019608号-1 )

GMT+8, 2024-4-26 14:31 , Processed in 0.184519 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表