forked from PaddlePaddle/PaddleTest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
84 changed files
with
3,503 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
framework/e2e/PaddleLT_new/layerApicase/math_zero_size/all_zero_size_0_func.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import numpy as np | ||
import paddle | ||
|
||
|
||
class LayerCase(paddle.nn.Layer): | ||
""" | ||
case名称: all_zero_size_func | ||
""" | ||
|
||
def __init__(self): | ||
super(LayerCase, self).__init__() | ||
|
||
def forward(self, x, ): | ||
""" | ||
forward | ||
""" | ||
|
||
paddle.seed(33) | ||
np.random.seed(33) | ||
out = paddle.all(x, axis=2, keepdim=False) | ||
return out | ||
|
||
|
||
|
||
def create_inputspec(): | ||
inputspec = ( | ||
paddle.static.InputSpec(shape=(-1, -1, -1, -1), dtype=paddle.bool, stop_gradient=False), | ||
) | ||
return inputspec | ||
|
||
def create_tensor_inputs(): | ||
""" | ||
paddle tensor | ||
""" | ||
inputs = (paddle.to_tensor(-1 + (1 - -1) * np.random.random([12, 0, 10, 10]).astype('bool'), dtype='bool', stop_gradient=False), ) | ||
return inputs | ||
|
||
|
||
def create_numpy_inputs(): | ||
""" | ||
numpy array | ||
""" | ||
inputs = (-1 + (1 - -1) * np.random.random([12, 0, 10, 10]).astype('bool'), ) | ||
return inputs | ||
|
45 changes: 45 additions & 0 deletions
45
framework/e2e/PaddleLT_new/layerApicase/math_zero_size/amax_zero_size_0_func.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import numpy as np | ||
import paddle | ||
|
||
|
||
class LayerCase(paddle.nn.Layer): | ||
""" | ||
case名称: amax_zero_size_func | ||
""" | ||
|
||
def __init__(self): | ||
super(LayerCase, self).__init__() | ||
|
||
def forward(self, x, ): | ||
""" | ||
forward | ||
""" | ||
|
||
paddle.seed(33) | ||
np.random.seed(33) | ||
out = paddle.amax(x, keepdim=False) | ||
return out | ||
|
||
|
||
|
||
def create_inputspec(): | ||
inputspec = ( | ||
paddle.static.InputSpec(shape=(-1, -1, -1, -1), dtype=paddle.float32, stop_gradient=False), | ||
) | ||
return inputspec | ||
|
||
def create_tensor_inputs(): | ||
""" | ||
paddle tensor | ||
""" | ||
inputs = (paddle.to_tensor(-1 + (1 - -1) * np.random.random([12, 0, 10, 10]).astype('float32'), dtype='float32', stop_gradient=False), ) | ||
return inputs | ||
|
||
|
||
def create_numpy_inputs(): | ||
""" | ||
numpy array | ||
""" | ||
inputs = (-1 + (1 - -1) * np.random.random([12, 0, 10, 10]).astype('float32'), ) | ||
return inputs | ||
|
45 changes: 45 additions & 0 deletions
45
framework/e2e/PaddleLT_new/layerApicase/math_zero_size/clone_zero_size_0_func.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import numpy as np | ||
import paddle | ||
|
||
|
||
class LayerCase(paddle.nn.Layer): | ||
""" | ||
case名称: clone_zero_size_func | ||
""" | ||
|
||
def __init__(self): | ||
super(LayerCase, self).__init__() | ||
|
||
def forward(self, x, ): | ||
""" | ||
forward | ||
""" | ||
|
||
paddle.seed(33) | ||
np.random.seed(33) | ||
out = paddle.clone(x, ) | ||
return out | ||
|
||
|
||
|
||
def create_inputspec(): | ||
inputspec = ( | ||
paddle.static.InputSpec(shape=(-1, -1, -1), dtype=paddle.float32, stop_gradient=False), | ||
) | ||
return inputspec | ||
|
||
def create_tensor_inputs(): | ||
""" | ||
paddle tensor | ||
""" | ||
inputs = (paddle.to_tensor(-1 + (1 - -1) * np.random.random([128, 0, 1]).astype('float32'), dtype='float32', stop_gradient=False), ) | ||
return inputs | ||
|
||
|
||
def create_numpy_inputs(): | ||
""" | ||
numpy array | ||
""" | ||
inputs = (-1 + (1 - -1) * np.random.random([128, 0, 1]).astype('float32'), ) | ||
return inputs | ||
|
45 changes: 45 additions & 0 deletions
45
framework/e2e/PaddleLT_new/layerApicase/math_zero_size/diff_zero_size_0_func.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import numpy as np | ||
import paddle | ||
|
||
|
||
class LayerCase(paddle.nn.Layer): | ||
""" | ||
case名称: diff_zero_size_func | ||
""" | ||
|
||
def __init__(self): | ||
super(LayerCase, self).__init__() | ||
|
||
def forward(self, x, ): | ||
""" | ||
forward | ||
""" | ||
|
||
paddle.seed(33) | ||
np.random.seed(33) | ||
out = paddle.diff(x, n=1, axis=-1 ) | ||
return out | ||
|
||
|
||
|
||
def create_inputspec(): | ||
inputspec = ( | ||
paddle.static.InputSpec(shape=(-1, -1, -1), dtype=paddle.float32, stop_gradient=False), | ||
) | ||
return inputspec | ||
|
||
def create_tensor_inputs(): | ||
""" | ||
paddle tensor | ||
""" | ||
inputs = (paddle.to_tensor(-1 + (1 - -1) * np.random.random([128, 0, 1]).astype('float32'), dtype='float32', stop_gradient=False), ) | ||
return inputs | ||
|
||
|
||
def create_numpy_inputs(): | ||
""" | ||
numpy array | ||
""" | ||
inputs = (-1 + (1 - -1) * np.random.random([128, 0, 1]).astype('float32'), ) | ||
return inputs | ||
|
43 changes: 43 additions & 0 deletions
43
framework/e2e/PaddleLT_new/layerApicase/math_zero_size/empty_zero_size_0_func.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import numpy as np | ||
import paddle | ||
|
||
|
||
class LayerCase(paddle.nn.Layer): | ||
""" | ||
case名称: empty_zero_size_func | ||
""" | ||
|
||
def __init__(self): | ||
super(LayerCase, self).__init__() | ||
|
||
def forward(self, x, ): | ||
""" | ||
forward | ||
""" | ||
|
||
paddle.seed(33) | ||
np.random.seed(33) | ||
out = paddle.empty(shape=[128, 0, 1], dtype='float32') | ||
return out | ||
|
||
|
||
|
||
def create_inputspec(): | ||
inputspec = () | ||
return inputspec | ||
|
||
def create_tensor_inputs(): | ||
""" | ||
paddle tensor | ||
""" | ||
inputs = () | ||
return inputs | ||
|
||
|
||
def create_numpy_inputs(): | ||
""" | ||
numpy array | ||
""" | ||
inputs = () | ||
return inputs | ||
|
52 changes: 52 additions & 0 deletions
52
framework/e2e/PaddleLT_new/layerApicase/math_zero_size/equal_zero_size_0_func.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import numpy as np | ||
import paddle | ||
|
||
|
||
class LayerCase(paddle.nn.Layer): | ||
""" | ||
case名称: equal_zero_size_func | ||
""" | ||
|
||
def __init__(self): | ||
super(LayerCase, self).__init__() | ||
|
||
def forward(self, x, y): | ||
""" | ||
forward | ||
""" | ||
|
||
paddle.seed(33) | ||
np.random.seed(33) | ||
out = paddle.equal(x, y ) | ||
return out | ||
|
||
|
||
|
||
def create_inputspec(): | ||
inputspec = ( | ||
paddle.static.InputSpec(shape=(-1, -1, -1), dtype=paddle.int32, stop_gradient=False), | ||
paddle.static.InputSpec(shape=(-1, -1, -1), dtype=paddle.int32, stop_gradient=False), | ||
) | ||
return inputspec | ||
|
||
def create_tensor_inputs(): | ||
""" | ||
paddle tensor | ||
""" | ||
inputs = ( | ||
paddle.to_tensor(-2 + 4 * np.random.random([128, 0, 1]).astype('int32'), dtype='int32', stop_gradient=False), | ||
paddle.to_tensor(-2 + 4 * np.random.random([128, 0, 1]).astype('int32'), dtype='int32', stop_gradient=False), | ||
) | ||
return inputs | ||
|
||
|
||
def create_numpy_inputs(): | ||
""" | ||
numpy array | ||
""" | ||
inputs = ( | ||
(-2 + 4 * np.random.random([128, 0, 1])).astype('int32'), | ||
(-2 + 4 * np.random.random([128, 0, 1])).astype('int32'), | ||
) | ||
return inputs | ||
|
45 changes: 45 additions & 0 deletions
45
framework/e2e/PaddleLT_new/layerApicase/math_zero_size/histogram_zero_size_0_func.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import numpy as np | ||
import paddle | ||
|
||
|
||
class LayerCase(paddle.nn.Layer): | ||
""" | ||
case名称: histogram_zero_size_func | ||
""" | ||
|
||
def __init__(self): | ||
super(LayerCase, self).__init__() | ||
|
||
def forward(self, x, ): | ||
""" | ||
forward | ||
""" | ||
|
||
paddle.seed(33) | ||
np.random.seed(33) | ||
out = paddle.histogram(x, bins=10, min=0, max=10) | ||
return out | ||
|
||
|
||
|
||
def create_inputspec(): | ||
inputspec = ( | ||
paddle.static.InputSpec(shape=(-1, -1, -1, -1), dtype=paddle.float32, stop_gradient=False), | ||
) | ||
return inputspec | ||
|
||
def create_tensor_inputs(): | ||
""" | ||
paddle tensor | ||
""" | ||
inputs = (paddle.to_tensor(-1 + (1 - -1) * np.random.random([12, 0, 10, 10]).astype('float32'), dtype='float32', stop_gradient=False), ) | ||
return inputs | ||
|
||
|
||
def create_numpy_inputs(): | ||
""" | ||
numpy array | ||
""" | ||
inputs = (-1 + (1 - -1) * np.random.random([12, 0, 10, 10]).astype('float32'), ) | ||
return inputs | ||
|
53 changes: 53 additions & 0 deletions
53
framework/e2e/PaddleLT_new/layerApicase/math_zero_size/index_select_0_func.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import numpy as np | ||
import paddle | ||
|
||
|
||
class LayerCase(paddle.nn.Layer): | ||
""" | ||
case名称: index_select_0 | ||
api简介: 沿着指定轴 axis 对输入 x 进行索引,取 index 中指定的相应项,创建并返回到一个新的Tensor | ||
""" | ||
|
||
def __init__(self): | ||
super(LayerCase, self).__init__() | ||
|
||
def forward(self, x, index, ): | ||
""" | ||
forward | ||
""" | ||
|
||
paddle.seed(33) | ||
np.random.seed(33) | ||
out = paddle.index_select(x, index, axis=1, ) | ||
return out | ||
|
||
|
||
|
||
def create_inputspec(): | ||
inputspec = ( | ||
paddle.static.InputSpec(shape=(-1, -1), dtype=paddle.float32, stop_gradient=False), | ||
paddle.static.InputSpec(shape=(-1,), dtype=paddle.int32, stop_gradient=True), | ||
) | ||
return inputspec | ||
|
||
def create_tensor_inputs(): | ||
""" | ||
paddle tensor | ||
""" | ||
inputs = ( | ||
paddle.to_tensor(-1 + (1 - -1) * np.random.random([128, 0, 3, 3]).astype('float32'), dtype='float32', stop_gradient=False), | ||
paddle.to_tensor([0, 2], dtype='int32', stop_gradient=False), | ||
) | ||
return inputs | ||
|
||
|
||
def create_numpy_inputs(): | ||
""" | ||
numpy array | ||
""" | ||
inputs = ( | ||
-1 + (1 - -1) * np.random.random([128, 0, 3, 3]).astype('float32'), | ||
np.array([0, 2]).astype('int32'), | ||
) | ||
return inputs | ||
|
Oops, something went wrong.