可以在prototxt文件中使用"Reshape"
层
然而,尝试在python中使用它(使用NetSpec()
):
n.resh = L.Reshape(n.fc3, reshape_param={'shape':'{dim:1 dim:1 dim:64 dim:64}'})
我只得到一个错误:
AttributeError: 'BlobShape' object has no attribute 'append'
尝试:
n.resh = L.Reshape(n.fc3, reshape_param={'shape':{'dim': [1, 1, 64, 64]}})
注意,形状向量[1, 1, 64, 64]
是作为列表而不是像prototxt语法中那样作为字符串传递的。
事实上,在使用NetSpec进行接口时,caffe.proto
中定义为repeated
的任何条目都应被视为列表/向量。