嗨,我如何修复错误吗?我想建立模型sequance和图像输入层,谢谢
2视图(30天)
显示旧的评论
![](http://www.tatmou.com/matlabcentral/answers/uploaded_files/1311035/image.jpeg)
tempLayers = [
imageInputLayer ([25 1 1],
“名称”
,
“imageinput”
)
32岁的convolution2dLayer (1 [3]
“名称”
,
“conv_1”
,
“填充”
,
“相同”
)
32岁的convolution2dLayer (1 [3]
“名称”
,
“conv_2”
,
“填充”
,
“相同”
)
flattenLayer (
“名称”
,
“平”
));
lgraph = addLayers (lgraph tempLayers);
seqInput = sequenceInputLayer (1,
“名字”
,
“sequance1”
);
lgraph = addLayers (lgraph seqInput);
seqInput = [
concatenationLayer (1、2、
“名称”
,
“concat”
)
fullyConnectedLayer (10,
“名称”
,
“fc_1”
)
fullyConnectedLayer (10,
“名称”
,
“fc_2”
)
fullyConnectedLayer (10,
“名称”
,
“fc_3”
)
classificationLayer (
“名称”
,
“classoutput”
));
lgraph = addLayers (lgraph seqInput);
lgraph = connectLayers (lgraph,
“sequance1”
,
“concat /三机一体”
);
lgraph = connectLayers (lgraph,
“平”
,
“concat / in2”
);
情节(lgraph)
analyzeNetwork (lgraph)
0评论
答案(1)
本
2023年3月13日
连接不扩大在维度,例如以下错误:
x =兰德(10);
y =兰德(1);
猫(x, y)
如果你想连接的输出平缓的输出sequance1您将需要定义如何连接这两个输入不同的维度。
一个方法可能会重复平缓的输出序列的维度,然后连接。你可以重复序列维度
functionLayer
:
repeatLayer = functionLayer (@ (x, y) dlarray (repmat (x,[1,1,大小(y, 3))),“认知行为治疗”),Formattable = true)
连平的第一输入
repeatLayer
和sequance1第二输入
repeatLayer
。然后连接
repeatLayer
和sequance1 concat。
注意,这是唯一的方式来定义连接序列和不连续,你可能想要实现一个连接使用不同的方法
functionLayer
或自定义层。