未验证 提交 96013528 编写于 作者: D Double_V 提交者: GitHub

fix pool APIs en doc, delete disable_static (#28679)

* fix pool exclusive and delete disable_static, test=develop

* fix pool1d  exclusive, test=develop

* fix pool APIs en doc, test=document_fix
上级 03f46e35
...@@ -90,7 +90,6 @@ class AvgPool1D(layers.Layer): ...@@ -90,7 +90,6 @@ class AvgPool1D(layers.Layer):
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
paddle.disable_static()
data = paddle.to_tensor(np.random.uniform(-1, 1, [1, 3, 32]).astype(np.float32)) data = paddle.to_tensor(np.random.uniform(-1, 1, [1, 3, 32]).astype(np.float32))
AvgPool1D = nn.AvgPool1D(kernel_size=2, stride=2, padding=0) AvgPool1D = nn.AvgPool1D(kernel_size=2, stride=2, padding=0)
...@@ -181,7 +180,6 @@ class AvgPool2D(layers.Layer): ...@@ -181,7 +180,6 @@ class AvgPool2D(layers.Layer):
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import numpy as np import numpy as np
paddle.disable_static()
# max pool2d # max pool2d
input = paddle.to_tensor(np.random.uniform(-1, 1, [1, 3, 32, 32]).astype(np.float32)) input = paddle.to_tensor(np.random.uniform(-1, 1, [1, 3, 32, 32]).astype(np.float32))
...@@ -273,7 +271,6 @@ class AvgPool3D(layers.Layer): ...@@ -273,7 +271,6 @@ class AvgPool3D(layers.Layer):
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import numpy as np import numpy as np
paddle.disable_static()
# avg pool3d # avg pool3d
input = paddle.to_tensor(np.random.uniform(-1, 1, [1, 2, 3, 32, 32]).astype(np.float32)) input = paddle.to_tensor(np.random.uniform(-1, 1, [1, 2, 3, 32, 32]).astype(np.float32))
...@@ -370,7 +367,6 @@ class MaxPool1D(layers.Layer): ...@@ -370,7 +367,6 @@ class MaxPool1D(layers.Layer):
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
paddle.disable_static()
data = paddle.to_tensor(np.random.uniform(-1, 1, [1, 3, 32]).astype(np.float32)) data = paddle.to_tensor(np.random.uniform(-1, 1, [1, 3, 32]).astype(np.float32))
MaxPool1D = nn.MaxPool1D(kernel_size=2, stride=2, padding=0) MaxPool1D = nn.MaxPool1D(kernel_size=2, stride=2, padding=0)
...@@ -464,7 +460,6 @@ class MaxPool2D(layers.Layer): ...@@ -464,7 +460,6 @@ class MaxPool2D(layers.Layer):
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import numpy as np import numpy as np
paddle.disable_static()
# max pool2d # max pool2d
input = paddle.to_tensor(np.random.uniform(-1, 1, [1, 3, 32, 32]).astype(np.float32)) input = paddle.to_tensor(np.random.uniform(-1, 1, [1, 3, 32, 32]).astype(np.float32))
...@@ -556,7 +551,6 @@ class MaxPool3D(layers.Layer): ...@@ -556,7 +551,6 @@ class MaxPool3D(layers.Layer):
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import numpy as np import numpy as np
paddle.disable_static()
# max pool3d # max pool3d
input = paddle.to_tensor(np.random.uniform(-1, 1, [1, 2, 3, 32, 32]).astype(np.float32)) input = paddle.to_tensor(np.random.uniform(-1, 1, [1, 2, 3, 32, 32]).astype(np.float32))
...@@ -652,7 +646,6 @@ class AdaptiveAvgPool1D(layers.Layer): ...@@ -652,7 +646,6 @@ class AdaptiveAvgPool1D(layers.Layer):
# #
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
paddle.disable_static()
data = paddle.to_tensor(np.random.uniform(-1, 1, [1, 3, 32]).astype(np.float32)) data = paddle.to_tensor(np.random.uniform(-1, 1, [1, 3, 32]).astype(np.float32))
AdaptiveAvgPool1D = nn.AdaptiveAvgPool1D(output_size=16) AdaptiveAvgPool1D = nn.AdaptiveAvgPool1D(output_size=16)
...@@ -728,7 +721,7 @@ class AdaptiveAvgPool2D(layers.Layer): ...@@ -728,7 +721,7 @@ class AdaptiveAvgPool2D(layers.Layer):
# #
import paddle import paddle
import numpy as np import numpy as np
paddle.disable_static()
input_data = np.random.rand(2, 3, 32, 32) input_data = np.random.rand(2, 3, 32, 32)
x = paddle.to_tensor(input_data) x = paddle.to_tensor(input_data)
# x.shape is [2, 3, 32, 32] # x.shape is [2, 3, 32, 32]
...@@ -816,7 +809,7 @@ class AdaptiveAvgPool3D(layers.Layer): ...@@ -816,7 +809,7 @@ class AdaptiveAvgPool3D(layers.Layer):
# avg(input[:, :, dstart:dend, hstart: hend, wstart: wend]) # avg(input[:, :, dstart:dend, hstart: hend, wstart: wend])
import paddle import paddle
import numpy as np import numpy as np
paddle.disable_static()
input_data = np.random.rand(2, 3, 8, 32, 32) input_data = np.random.rand(2, 3, 8, 32, 32)
x = paddle.to_tensor(input_data) x = paddle.to_tensor(input_data)
# x.shape is [2, 3, 8, 32, 32] # x.shape is [2, 3, 8, 32, 32]
...@@ -893,7 +886,6 @@ class AdaptiveMaxPool1D(layers.Layer): ...@@ -893,7 +886,6 @@ class AdaptiveMaxPool1D(layers.Layer):
# #
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
paddle.disable_static()
data = paddle.to_tensor(np.random.uniform(-1, 1, [1, 3, 32]).astype(np.float32)) data = paddle.to_tensor(np.random.uniform(-1, 1, [1, 3, 32]).astype(np.float32))
AdaptiveMaxPool1D = nn.AdaptiveMaxPool1D(output_size=16) AdaptiveMaxPool1D = nn.AdaptiveMaxPool1D(output_size=16)
...@@ -964,7 +956,7 @@ class AdaptiveMaxPool2D(layers.Layer): ...@@ -964,7 +956,7 @@ class AdaptiveMaxPool2D(layers.Layer):
# #
import paddle import paddle
import numpy as np import numpy as np
paddle.disable_static()
input_data = np.random.rand(2, 3, 32, 32) input_data = np.random.rand(2, 3, 32, 32)
x = paddle.to_tensor(input_data) x = paddle.to_tensor(input_data)
adaptive_max_pool = paddle.nn.AdaptiveMaxPool2D(output_size=3, return_mask=True) adaptive_max_pool = paddle.nn.AdaptiveMaxPool2D(output_size=3, return_mask=True)
...@@ -1036,7 +1028,7 @@ class AdaptiveMaxPool3D(layers.Layer): ...@@ -1036,7 +1028,7 @@ class AdaptiveMaxPool3D(layers.Layer):
# max(input[:, :, dstart:dend, hstart: hend, wstart: wend]) # max(input[:, :, dstart:dend, hstart: hend, wstart: wend])
import paddle import paddle
import numpy as np import numpy as np
paddle.disable_static()
input_data = np.random.rand(2, 3, 8, 32, 32) input_data = np.random.rand(2, 3, 8, 32, 32)
x = paddle.to_tensor(input_data) x = paddle.to_tensor(input_data)
pool = paddle.nn.AdaptiveMaxPool3D(output_size=4) pool = paddle.nn.AdaptiveMaxPool3D(output_size=4)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册