Browse Source

add AvgPooling layer

tags/v0.2.0-alpha
zhaojichen 6 years ago
parent
commit
f24065806d
1 changed files with 17 additions and 0 deletions
  1. +17
    -0
      mindspore/nn/layer/pooling.py

+ 17
- 0
mindspore/nn/layer/pooling.py View File

@@ -255,9 +255,26 @@ class AvgPool1d(_PoolNd):
Examples:
>>> pool = nn.AvgPool1d(kernel_size=3, strides=1)
>>> x = Tensor(np.random.randint(0, 10, [1, 2, 4, 4]), mindspore.float32)
[[[[8. 8. 7. 4.]
[8. 4. 0. 9.]
[6. 4. 6. 1.]
[6. 8. 8. 5.]
[[4. 8. 5. 4.]
[8. 4. 7. 5.]
[3. 5. 3. 9.]
[7. 5. 4. 7.]]]]
>>> output = pool(x)
>>> output.shape()
(1, 2, 4, 2)
>>> output
[[[[7.6640625 6.3320312]
[4. 4.3320312]
[5.3320312 3.6660156]
[7.3320312 7 ]
[[5.6640625 5.6640625]
[6.3320312 5.3320312]
[3.6660156 5.6640625]
[5.3320312 5.3320312]]]]
"""

def __init__(self,


Loading…
Cancel
Save