docs/tutorial/layers/reshape.md
Layer type: Reshape
Implementation: ./src/caffe/layers/reshape_layer.cpp
Input
Output
reshape_paramSample
layer {
name: "reshape"
type: "Reshape"
bottom: "input"
top: "output"
reshape_param {
shape {
dim: 0 # copy the dimension from below
dim: 2
dim: 3
dim: -1 # infer it from the other dimensions
}
}
}
The Reshape layer can be used to change the dimensions of its input, without changing its data. Just like the Flatten layer, only the dimensions are changed; no data is copied in the process.
Output dimensions are specified by the ReshapeParam proto. Positive numbers are used directly, setting the corresponding dimension of the output blob. In addition, two special values are accepted for any of the target dimension values:
dim: 0 as the 1st target dimension.[] for MATLAB's reshape: this dimension is calculated to keep the overall element count the same as in the bottom layer. At most one -1 can be used in a reshape operation.As another example, specifying reshape_param { shape { dim: 0 dim: -1 } } makes the layer behave in exactly the same way as the Flatten layer.
ReshapeParameter reshape_param)
shape./src/caffe/proto/caffe.proto:{% highlight Protobuf %} {% include proto/ReshapeParameter.txt %} {% endhighlight %}