Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Add Op UnitTest For Max/Mod/Multiply #1482

Merged
merged 32 commits into from
Jun 25, 2023

Conversation

enkilee
Copy link
Contributor

@enkilee enkilee commented May 26, 2023

描述

From #1378

为max、mod、multiply类型算子增加新的测试用例

序号 算子名 单测文件
47 max test_max_op.py ,test_min_op.py

算子类型

  • ElementWise:输入张量索引和输出张量索引之间存在一对一的对应关系
  • Broadcast:输入张量索引和输出张量索引之间存在一对多的对应关系
  • Injective:单射算子,可以将一个输出 axis 映射到一个输入 axis
  • Reduction:输入张量索引和输出张量索引之间存在多对一的对应关系
  • OutFusible:复杂算子,仍然可以将一对一的算子融合到其输出中。
  • kNonFusible:无法融合的算子

OpMapper

  • 该算子是否 OpMapper? 如果是,请贴出在 Paddle 中对应的 OpMaker 代码路径。(给出 Github 链接更好)

Test Cases Checklist

张量维度

  • 1D 张量
  • 2D 张量
  • 3D 张量
  • 4D 张量

special shape

挑选 2D/3D/4D 张量中的一个,测试下面的特殊情况。

  • 其中一个维度为 1
  • 其中一个维度小于 1024
  • 其中一个维度大于 1024
  • 向量的所有维度都是 1

张量数据类型

  • int32
  • int64
  • float16
  • float32
  • float64

广播

  • 这个算子是否支持广播?
  • 广播的测试样例

算子属性

算子属性的测试用例。

  • 属性:属性类型-可取值
    • op_type
    • axis
    • keepdim
  • 使用 OpTestHelper 测试上述属性的笛卡尔积组合

备注

test_max_op为防止超过200s,把里面的minimum单独新增一测试文件

描述

From #1378

为mod类型算子增加新的测试用例

序号 算子名 单测文件
48 mod test_mod_op.py

算子类型

  • ElementWise:输入张量索引和输出张量索引之间存在一对一的对应关系
  • Broadcast:输入张量索引和输出张量索引之间存在一对多的对应关系
  • Injective:单射算子,可以将一个输出 axis 映射到一个输入 axis
  • Reduction:输入张量索引和输出张量索引之间存在多对一的对应关系
  • OutFusible:复杂算子,仍然可以将一对一的算子融合到其输出中。
  • kNonFusible:无法融合的算子

OpMapper

  • 该算子是否 OpMapper? 如果是,请贴出在 Paddle 中对应的 OpMaker 代码路径。(给出 Github 链接更好)

Test Cases Checklist

张量维度

  • 1D 张量
  • 2D 张量
  • 3D 张量
  • 4D 张量

special shape

挑选 2D/3D/4D 张量中的一个,测试下面的特殊情况。

  • 其中一个维度为 1
  • 其中一个维度小于 1024
  • 其中一个维度大于 1024
  • 向量的所有维度都是 1

张量数据类型

  • int32
  • int64
  • float16
  • float32
  • float64

广播

  • 这个算子是否支持广播?
  • 广播的测试样例

算子属性

算子属性的测试用例。

  • 属性:属性类型-可取值
    • op_type
    • axis
    • keepdim
  • 使用 OpTestHelper 测试上述属性的笛卡尔积组合

备注

描述

From #1378

为multiply 类型算子增加新的测试用例

序号 算子名 单测文件
50 multiply test_multiply_op.py

算子类型

  • ElementWise:输入张量索引和输出张量索引之间存在一对一的对应关系
  • Broadcast:输入张量索引和输出张量索引之间存在一对多的对应关系
  • Injective:单射算子,可以将一个输出 axis 映射到一个输入 axis
  • Reduction:输入张量索引和输出张量索引之间存在多对一的对应关系
  • OutFusible:复杂算子,仍然可以将一对一的算子融合到其输出中。
  • kNonFusible:无法融合的算子

OpMapper

  • 该算子是否 OpMapper? 如果是,请贴出在 Paddle 中对应的 OpMaker 代码路径。(给出 Github 链接更好)

Test Cases Checklist

张量维度

  • 1D 张量
  • 2D 张量
  • 3D 张量
  • 4D 张量

special shape

挑选 2D/3D/4D 张量中的一个,测试下面的特殊情况。

  • 其中一个维度为 1
  • 其中一个维度小于 1024
  • 其中一个维度大于 1024
  • 向量的所有维度都是 1

张量数据类型

  • int32
  • int64
  • float16
  • float32
  • float64

广播

  • 这个算子是否支持广播?
  • 广播的测试样例

算子属性

算子属性的测试用例。

  • 属性:属性类型-可取值
    • op_type
    • axis
    • keepdim
  • 使用 OpTestHelper 测试上述属性的笛卡尔积组合

备注

@paddle-bot
Copy link

paddle-bot bot commented May 26, 2023

Thanks for your contribution!

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label May 26, 2023
@enkilee enkilee changed the title Add Op UnitTest For Max Add Op UnitTest For Max/Mod/Mul/Multiply Jun 2, 2023
python/tests/ops/test_max_minmum_op.py Outdated Show resolved Hide resolved
python/tests/ops/test_max_minmum_op.py Outdated Show resolved Hide resolved
python/tests/ops/test_max_minmum_op.py Outdated Show resolved Hide resolved
python/tests/ops/test_mul_op.py Outdated Show resolved Hide resolved
python/tests/ops/test_multiply_op.py Show resolved Hide resolved
python/tests/ops/test_max_minmum_op.py Outdated Show resolved Hide resolved
@enkilee
Copy link
Contributor Author

enkilee commented Jun 4, 2023

2023-06-04 16:03:22 AssertionError: False is not true : [Check Outputs] [NVGPU] The 0-th output: total 627 different results, offset=1, shape=(32, 32), 4.242500e+02 vs 4.240000e+02. Maximum diff of the whole array: maximum_relative_diff=4.633789e-01, maximum_absolute_diff=1.500000e+00.

2023-06-04 16:03:22 AssertionError: False is not true : [Check Outputs] [NVGPU] The 0-th output: total 10 different results, offset=3, shape=(2, 3, 3), -3.262500e+01 vs -3.259375e+01. Maximum diff of the whole array: maximum_relative_diff=1.491547e-02, maximum_absolute_diff=1.250000e-01.

2023-06-04 16:03:22 AssertionError: False is not true : [Check Outputs] [NVGPU] The 0-th output: total 504 different results, offset=0, shape=(16, 8, 4, 4), 3.392578e+00 vs 3.396484e+00. Maximum diff of the whole array: maximum_relative_diff=1.463867e+00, maximum_absolute_diff=1.250000e-01.

float16的误差超了。

@thisjiang
Copy link
Collaborator

2023-06-04 16:03:22 AssertionError: False is not true : [Check Outputs] [NVGPU] The 0-th output: total 627 different results, offset=1, shape=(32, 32), 4.242500e+02 vs 4.240000e+02. Maximum diff of the whole array: maximum_relative_diff=4.633789e-01, maximum_absolute_diff=1.500000e+00.

2023-06-04 16:03:22 AssertionError: False is not true : [Check Outputs] [NVGPU] The 0-th output: total 10 different results, offset=3, shape=(2, 3, 3), -3.262500e+01 vs -3.259375e+01. Maximum diff of the whole array: maximum_relative_diff=1.491547e-02, maximum_absolute_diff=1.250000e-01.

2023-06-04 16:03:22 AssertionError: False is not true : [Check Outputs] [NVGPU] The 0-th output: total 504 different results, offset=0, shape=(16, 8, 4, 4), 3.392578e+00 vs 3.396484e+00. Maximum diff of the whole array: maximum_relative_diff=1.463867e+00, maximum_absolute_diff=1.250000e-01.

float16的误差超了。

这是哪个测试啊?multiply还是mul?

@enkilee
Copy link
Contributor Author

enkilee commented Jun 5, 2023

mul的float16

@enkilee enkilee changed the title Add Op UnitTest For Max/Mod/Mul/Multiply Add Op UnitTest For Max/Mod/Multiply Jun 20, 2023
@enkilee
Copy link
Contributor Author

enkilee commented Jun 20, 2023

@FisherWY please verify if u free. thx

Copy link
Collaborator

@thisjiang thisjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thisjiang thisjiang merged commit 578c30e into PaddlePaddle:develop Jun 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants