Flatten.md 950 字节
Newer Older
J
Jason 已提交
1 2 3 4 5 6 7 8 9 10
## Flatten


### [Flatten](http://caffe.berkeleyvision.org/tutorial/layers/flatten.html)
```
layer {
    name: "flatten"
    type: "Flatten"
    bottom: "data"
    top: "flatten"
S
SunAhong1993 已提交
11
    flatten_param {
J
Jason 已提交
12
        axis: 1
S
SunAhong1993 已提交
13
	end_axis: -1
J
Jason 已提交
14 15 16 17 18
    }
}
```


S
SunAhong1993 已提交
19
### [paddle.fluid.layers.reshape](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#permalink-134-reshape)
J
Jason 已提交
20 21 22 23 24 25 26 27 28 29 30 31 32
```python
paddle.fluid.layers.reshape(
    x, 
    shape, 
    actual_shape=None, 
    act=None, 
    inplace=False, 
    name=None
)
```  

### 功能差异
#### 输入参数
J
Jason 已提交
33 34
Caffe:分别使用参数`axis``end_axis`表示起始轴和结束轴,[axis, end_axis]轴上的数据将被压缩至一维,
但如若`axis-end_axis==1`时,则会在`axis`轴之后插入一维;
J
Jason 已提交
35
> 输入数据shape[2, 3, 4, 5]  
J
Jason 已提交
36 37
> axis=1, end_axis=3:输出shape[2, 60]  
> axis=3, end_axis=2:输出shape[2, 3, 4, 1, 5]  
J
Jason 已提交
38 39

PaddlePaddle:通过在`shape`参数设置具体的输出shape。