diff --git a/framework/e2e/PaddleLT_new/layerApicase/__init__.py b/framework/e2e/PaddleLT_new/layerApicase/__init__.py index 2a1899ce9a..337073fcca 100644 --- a/framework/e2e/PaddleLT_new/layerApicase/__init__.py +++ b/framework/e2e/PaddleLT_new/layerApicase/__init__.py @@ -1,3 +1,5 @@ import layerApicase.perf_monitor import layerApicase.nn_sublayer +import layerApicase.nn_extreme_size import layerApicase.math_sublayer +import layerApicase.math_extreme_size diff --git a/framework/e2e/PaddleLT_new/layerApicase/math_extreme_size/__init__.py b/framework/e2e/PaddleLT_new/layerApicase/math_extreme_size/__init__.py new file mode 100644 index 0000000000..7f0cb86fe7 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerApicase/math_extreme_size/__init__.py @@ -0,0 +1,15 @@ +import os +import glob + +# 获取当前文件所在目录 +current_dir = os.path.dirname(__file__) + +# 获取当前目录下所有的 .py 文件路径 +py_files = glob.glob(os.path.join(current_dir, "*.py")) + +# 动态导入所有 .py 文件 +for py_file in py_files: + # 获取文件名(不含扩展名) + module_name = os.path.basename(py_file)[:-3] + # 导入模块 + __import__('layerApicase.math_extreme_size.' + module_name, globals(), locals(), []) diff --git a/framework/e2e/PaddleLT_new/layerApicase/math_extreme_size/abs_giant_size_func.py b/framework/e2e/PaddleLT_new/layerApicase/math_extreme_size/abs_giant_size_func.py new file mode 100644 index 0000000000..c4585dca0b --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerApicase/math_extreme_size/abs_giant_size_func.py @@ -0,0 +1,46 @@ +import numpy as np +import paddle + + +class LayerCase(paddle.nn.Layer): + """ + case名称: abs_base + api简介: 求绝对值 + """ + + def __init__(self): + super(LayerCase, self).__init__() + + def forward(self, x, ): + """ + forward + """ + + paddle.seed(33) + np.random.seed(33) + out = paddle.abs(x, ) + return out + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, -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([1024, 256, 128, 100, 2]).astype('float32'), dtype='float32', stop_gradient=False), ) + return inputs + + +def create_numpy_inputs(): + """ + numpy array + """ + inputs = (-1 + (1 - -1) * np.random.random([1024, 256, 128, 100, 2]).astype('float32'), ) + return inputs + diff --git a/framework/e2e/PaddleLT_new/layerApicase/nn_extreme_size/Conv2D_giant_size_class.py b/framework/e2e/PaddleLT_new/layerApicase/nn_extreme_size/Conv2D_giant_size_class.py new file mode 100644 index 0000000000..2d1178d84b --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerApicase/nn_extreme_size/Conv2D_giant_size_class.py @@ -0,0 +1,47 @@ +import numpy as np +import paddle + + +class LayerCase(paddle.nn.Layer): + """ + case名称: Conv2D_giant_size_class + api简介: 2维卷积 + """ + + def __init__(self): + super(LayerCase, self).__init__() + self.func = paddle.nn.Conv2D(kernel_size=[3, 3], in_channels=256, out_channels=1, ) + + def forward(self, data, ): + """ + forward + """ + + paddle.seed(33) + np.random.seed(33) + out = self.func(data, ) + return out + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 256, -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([1024, 256, 128, 200]).astype('float32'), dtype='float32', stop_gradient=False), ) + return inputs + + +def create_numpy_inputs(): + """ + numpy array + """ + inputs = (-1 + (1 - -1) * np.random.random([1024, 256, 128, 200]).astype('float32'), ) + return inputs + diff --git a/framework/e2e/PaddleLT_new/layerApicase/nn_extreme_size/__init__.py b/framework/e2e/PaddleLT_new/layerApicase/nn_extreme_size/__init__.py new file mode 100644 index 0000000000..394a91e57c --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerApicase/nn_extreme_size/__init__.py @@ -0,0 +1,15 @@ +import os +import glob + +# 获取当前文件所在目录 +current_dir = os.path.dirname(__file__) + +# 获取当前目录下所有的 .py 文件路径 +py_files = glob.glob(os.path.join(current_dir, "*.py")) + +# 动态导入所有 .py 文件 +for py_file in py_files: + # 获取文件名(不含扩展名) + module_name = os.path.basename(py_file)[:-3] + # 导入模块 + __import__('layerApicase.nn_extreme_size.' + module_name, globals(), locals(), []) diff --git a/framework/e2e/PaddleLT_new/torch_case/layerApicase/math_extreme_size/__init__.py b/framework/e2e/PaddleLT_new/torch_case/layerApicase/math_extreme_size/__init__.py new file mode 100644 index 0000000000..69d1f390c9 --- /dev/null +++ b/framework/e2e/PaddleLT_new/torch_case/layerApicase/math_extreme_size/__init__.py @@ -0,0 +1,15 @@ +import os +import glob + +# 获取当前文件所在目录 +current_dir = os.path.dirname(__file__) + +# 获取当前目录下所有的 .py 文件路径 +py_files = glob.glob(os.path.join(current_dir, "*.py")) + +# 动态导入所有 .py 文件 +for py_file in py_files: + # 获取文件名(不含扩展名) + module_name = os.path.basename(py_file)[:-3] + # 导入模块 + __import__('torch_case.layerApicase.math_extreme_size.' + module_name, globals(), locals(), []) diff --git a/framework/e2e/PaddleLT_new/torch_case/layerApicase/math_extreme_size/abs_giant_size_func.py b/framework/e2e/PaddleLT_new/torch_case/layerApicase/math_extreme_size/abs_giant_size_func.py new file mode 100644 index 0000000000..7979082a97 --- /dev/null +++ b/framework/e2e/PaddleLT_new/torch_case/layerApicase/math_extreme_size/abs_giant_size_func.py @@ -0,0 +1,39 @@ +import numpy as np +import torch +import torch.nn as nn + + +class LayerCase(nn.Module): + """ + case名称: abs_base + api简介: 求绝对值 + """ + + def __init__(self): + super(LayerCase, self).__init__() + + def forward(self, x): + """ + forward + """ + torch.manual_seed(33) + np.random.seed(33) + out = torch.abs(x) + return out + + +def create_tensor_inputs(): + """ + PyTorch tensor + """ + inputs = (torch.tensor((-1 + 2 * np.random.random([1024, 256, 128, 100, 2])).astype(np.float32), dtype=torch.float32, requires_grad=True), ) + return inputs + + +def create_numpy_inputs(): + """ + numpy array + """ + # 生成一个形状为[1024, 256, 128, 100, 2]的随机numpy数组,数据范围在[-1, 1) + inputs = ((-1 + 2 * np.random.random([1024, 256, 128, 100, 2])).astype('float32'),) + return inputs diff --git a/framework/e2e/PaddleLT_new/torch_case/layerApicase/nn_extreme_size/Conv2D_giant_size_class.py b/framework/e2e/PaddleLT_new/torch_case/layerApicase/nn_extreme_size/Conv2D_giant_size_class.py new file mode 100644 index 0000000000..59f6dce5f7 --- /dev/null +++ b/framework/e2e/PaddleLT_new/torch_case/layerApicase/nn_extreme_size/Conv2D_giant_size_class.py @@ -0,0 +1,39 @@ +import numpy as np +import torch +import torch.nn as nn + + +class LayerCase(nn.Module): + """ + case名称: Conv2D_giant_size_class + api简介: 2维卷积 + """ + + def __init__(self): + super(LayerCase, self).__init__() + self.func = nn.Conv2d(in_channels=256, out_channels=1, kernel_size=3, stride=1, padding=1) + + def forward(self, data): + """ + forward + """ + torch.manual_seed(33) + np.random.seed(33) + out = self.func(data) + return out + + +def create_tensor_inputs(): + """ + PyTorch tensor + """ + inputs = (torch.tensor((-1 + 2 * np.random.random([1024, 256, 128, 200])).astype(np.float32), dtype=torch.float32, requires_grad=True), ) + return inputs + + +def create_numpy_inputs(): + """ + numpy array + """ + inputs = ((-1 + 2 * np.random.random([1024, 256, 128, 200])).astype('float32'),) + return inputs diff --git a/framework/e2e/PaddleLT_new/torch_case/layerApicase/nn_extreme_size/__init__.py b/framework/e2e/PaddleLT_new/torch_case/layerApicase/nn_extreme_size/__init__.py new file mode 100644 index 0000000000..fc4b3d089e --- /dev/null +++ b/framework/e2e/PaddleLT_new/torch_case/layerApicase/nn_extreme_size/__init__.py @@ -0,0 +1,15 @@ +import os +import glob + +# 获取当前文件所在目录 +current_dir = os.path.dirname(__file__) + +# 获取当前目录下所有的 .py 文件路径 +py_files = glob.glob(os.path.join(current_dir, "*.py")) + +# 动态导入所有 .py 文件 +for py_file in py_files: + # 获取文件名(不含扩展名) + module_name = os.path.basename(py_file)[:-3] + # 导入模块 + __import__('torch_case.layerApicase.nn_extreme_size.' + module_name, globals(), locals(), []) diff --git a/framework/e2e/PaddleLT_new/torch_case/layerApicase/nn_sublayer/AdaptiveAvgPool3D_8_class.py b/framework/e2e/PaddleLT_new/torch_case/layerApicase/nn_sublayer/AdaptiveAvgPool3D_8_class.py new file mode 100644 index 0000000000..8e8221eb47 --- /dev/null +++ b/framework/e2e/PaddleLT_new/torch_case/layerApicase/nn_sublayer/AdaptiveAvgPool3D_8_class.py @@ -0,0 +1,39 @@ +import numpy as np +import torch +import torch.nn as nn + + +class LayerCase(nn.Module): + """ + case名称: AdaptiveAvgPool3D_8 + api简介: 3维自适应池化 + """ + + def __init__(self): + super(LayerCase, self).__init__() + self.func = nn.AdaptiveAvgPool3d(output_size=(1, 1, 1)) + + def forward(self, data): + """ + forward + """ + torch.manual_seed(33) + np.random.seed(33) + out = self.func(data) + return out + + +def create_tensor_inputs(): + """ + PyTorch tensor + """ + inputs = (torch.tensor(-10 + (10 - -10) * np.random.random([2, 3, 8, 32, 32]).astype('float32'), dtype=torch.float32, requires_grad=True), ) + return inputs + + +def create_numpy_inputs(): + """ + numpy array + """ + inputs = (-10 + (10 - -10) * np.random.random([2, 3, 8, 32, 32]).astype('float32'), ) + return inputs