TensorFlow2._:model.summary() Output Shape为multiple解决方法

简介: TensorFlow2._:model.summary() Output Shape为multiple解决方法

使用TensorFlow2.*版本进行构建模型,然后打印模型的结构发现Output Shape为multiple,出现的原因是模型不知道输入数据的格式

三种解决办法:

方法一:使用函数式API

# 指定输入和输出层
model=Model(Input(shape=(None,28,28,1)),outputs)

方法二:在class类中第一个层添加input_shape

self.conv1 = Conv2D(filters=6,
                            kernel_size=5,
                            input_shape=(32, 32, 1))

方法三:调用模型的call函数,参数为输入数据格式的Input层

history.call(Input(shape=(32, 32, 1)))


目录
相关文章
|
3月前
|
机器学习/深度学习 人工智能
【CatBoost报错解决】CatBoostError: Bad value for num feature[non default doc idx=0,feature idx=19]=
【CatBoost报错解决】CatBoostError: Bad value for num feature[non default doc idx=0,feature idx=19]=
|
8月前
|
机器学习/深度学习 自然语言处理 数据挖掘
UnifiedEAE: A Multi-Format Transfer Learning Model for Event Argument Extraction via Variational论文解读
事件论元抽取(Event argument extraction, EAE)旨在从文本中抽取具有特定角色的论元,在自然语言处理中已被广泛研究。
49 0
|
11月前
|
PyTorch 算法框架/工具 异构计算
Pytorch出现RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor)
这个问题的主要原因是输入的数据类型与网络参数的类型不符。
186 0
|
机器学习/深度学习 算法 数据挖掘
【多标签文本分类】SGM: Sequence Generation Model for Multi-Label Classification
【多标签文本分类】SGM: Sequence Generation Model for Multi-Label Classification
106 0
【多标签文本分类】SGM: Sequence Generation Model for Multi-Label Classification
|
机器学习/深度学习 数据挖掘
【多标签文本分类】Balancing Methods for Multi-label Text Classification with Long-Tailed Class Distribution
【多标签文本分类】Balancing Methods for Multi-label Text Classification with Long-Tailed Class Distribution
【多标签文本分类】Balancing Methods for Multi-label Text Classification with Long-Tailed Class Distribution
|
TensorFlow 算法框架/工具
TensorFlow修改图像尺寸:AttributeError: module ‘tensorflow._api.v2.image‘ has no attribute ‘image‘
TensorFlow修改图像尺寸:AttributeError: module ‘tensorflow._api.v2.image‘ has no attribute ‘image‘
96 0
TensorFlow修改图像尺寸:AttributeError: module ‘tensorflow._api.v2.image‘ has no attribute ‘image‘
Re1:读论文 C&S (Correct and Smooth) Combining Label Propagation and Simple Models Out-performs Graph Ne
Re1:读论文 C&S (Correct and Smooth) Combining Label Propagation and Simple Models Out-performs Graph Ne
Re1:读论文 C&S (Correct and Smooth) Combining Label Propagation and Simple Models Out-performs Graph Ne
|
TensorFlow 算法框架/工具
成功解决AttributeError: module tensorflow.image has no attribute resize
成功解决AttributeError: module tensorflow.image has no attribute resize
|
算法框架/工具 Windows
|
XML 数据格式
Adobe form batch output print mode - multiple
Customer wants to render the body page 4 times on 4 different master page in one PDF. Take “Invoice” as example, the first copy will be printed on master page with text “for Customer”, the second copy will be printed on master page with text “for archive”.
103 0