已合并
test update ut #32254
huangyunlong创建于 3月24日
test update ut #32254
已合并
共 5 个文件变更+7-4
| @@ -118,6 +118,7 @@ class TestONNXRuntime_npu(onnx_test_common._TestONNXRuntime): | |||
| 118 | 118 | ||
| 119 | # ONNX supports bfloat16 for opsets >= 13 | 119 | # ONNX supports bfloat16 for opsets >= 13 |
| 120 | # Add, Sub and Mul ops don't support bfloat16 cpu in onnxruntime. | 120 | # Add, Sub and Mul ops don't support bfloat16 cpu in onnxruntime. |
| 121 | + | ||
| 121 | 122 | ||
| 122 | 123 | ||
| 123 | def test_arithmetic_bfp16(self): | 124 | def test_arithmetic_bfp16(self): |
| @@ -725,6 +725,7 @@ class TestUtilityFuns(_BaseTestCase): | |||
| 725 | onnx_model = onnx.load(io.BytesIO(f.getvalue())) | 725 | onnx_model = onnx.load(io.BytesIO(f.getvalue())) |
| 726 | self.assertEqual(len(onnx_model.graph.initializer), 0) | 726 | self.assertEqual(len(onnx_model.graph.initializer), 0) |
| 727 | 727 | ||
| 728 | + # onnx need protobuf | ||
| 728 | def test_verbose(self): | 729 | def test_verbose(self): |
| 729 | class MyModule(torch.nn.Module): | 730 | class MyModule(torch.nn.Module): |
| 730 | def forward(self, input_): | 731 | def forward(self, input_): |
| @@ -1243,6 +1243,7 @@ class TestMemoryProfilerE2E(TestCase): | |||
| 1243 | aten::add_.Tensor 3 (PARAMETER), 11 (OPTIMIZER_STATE) -> 3 (PARAMETER)""", | 1243 | aten::add_.Tensor 3 (PARAMETER), 11 (OPTIMIZER_STATE) -> 3 (PARAMETER)""", |
| 1244 | ) | 1244 | ) |
| 1245 | 1245 | ||
| 1246 | + | ||
| 1246 | def test_categories_e2e_sequential_fwd(self) -> None: | 1247 | def test_categories_e2e_sequential_fwd(self) -> None: |
| 1247 | model = torch.nn.Sequential( | 1248 | model = torch.nn.Sequential( |
| 1248 | torch.nn.Linear(2, 4, bias=True), | 1249 | torch.nn.Linear(2, 4, bias=True), |
| @@ -1264,6 +1265,7 @@ class TestMemoryProfilerE2E(TestCase): | |||
| 1264 | aten::detach 8 (ACTIVATION) -> ???""", | 1265 | aten::detach 8 (ACTIVATION) -> ???""", |
| 1265 | ) | 1266 | ) |
| 1266 | 1267 | ||
| 1268 | + | ||
| 1267 | def test_categories_e2e_sequential_fwd_bwd(self) -> None: | 1269 | def test_categories_e2e_sequential_fwd_bwd(self) -> None: |
| 1268 | model = torch.nn.Sequential( | 1270 | model = torch.nn.Sequential( |
| 1269 | torch.nn.Linear(2, 4, bias=True), | 1271 | torch.nn.Linear(2, 4, bias=True), |
| @@ -1339,6 +1341,7 @@ class TestMemoryProfilerE2E(TestCase): | |||
| 1339 | aten::detach 29 (GRADIENT) -> ???""", | 1341 | aten::detach 29 (GRADIENT) -> ???""", |
| 1340 | ) | 1342 | ) |
| 1341 | 1343 | ||
| 1344 | + | ||
| 1342 | def test_memory_timeline(self) -> None: | 1345 | def test_memory_timeline(self) -> None: |
| 1343 | model = torch.nn.Sequential( | 1346 | model = torch.nn.Sequential( |
| 1344 | torch.nn.Linear(64, 512, bias=True), | 1347 | torch.nn.Linear(64, 512, bias=True), |
| @@ -1401,7 +1404,7 @@ class TestMemoryProfilerE2E(TestCase): | |||
| 1401 | for _, action, (key, version), size in prof._memory_profile().timeline | 1404 | for _, action, (key, version), size in prof._memory_profile().timeline |
| 1402 | # We generally don't care about tiny allocations during memory | 1405 | # We generally don't care about tiny allocations during memory |
| 1403 | # profiling and they add a lot of noise to the unit test. | 1406 | # profiling and they add a lot of noise to the unit test. |
| 1404 | - if size > 1024 | 1407 | + if size > 1024 and isinstance(key, _memory_profiler.TensorKey) |
| 1405 | ] | 1408 | ] |
| 1406 | 1409 | ||
| 1407 | self.assertExpectedInline( | 1410 | self.assertExpectedInline( |
| @@ -19,3 +19,4 @@ parameterized==0.9.0 | |||
| 19 | torch-scatter==2.1.2 | 19 | torch-scatter==2.1.2 |
| 20 | torchvision==0.22.0 | 20 | torchvision==0.22.0 |
| 21 | ml-dtypes==0.2.0 | 21 | ml-dtypes==0.2.0 |
| 22 | +protobuf==3.20.2 | ||
| @@ -30773,9 +30773,6 @@ | |||
| 30773 | "test_sparse_zeros_trunc_npu_int8 (__main__.TestSparseUnaryUfuncsPRIVATEUSE1)": ["", [""]], | 30773 | "test_sparse_zeros_trunc_npu_int8 (__main__.TestSparseUnaryUfuncsPRIVATEUSE1)": ["", [""]], |
| 30774 | "test_sparse_zeros_trunc_npu_uint8 (__main__.TestSparseUnaryUfuncsPRIVATEUSE1)": ["", [""]], | 30774 | "test_sparse_zeros_trunc_npu_uint8 (__main__.TestSparseUnaryUfuncsPRIVATEUSE1)": ["", [""]], |
| 30775 | "test_memory_timeline_no_id (__main__.TestMemoryProfilerE2E)": ["", [""]], | 30775 | "test_memory_timeline_no_id (__main__.TestMemoryProfilerE2E)": ["", [""]], |
| 30776 | - "test_categories_e2e_sequential_fwd (__main__.TestMemoryProfilerE2E)": ["", ["A2"]], | ||
| 30777 | - "test_categories_e2e_sequential_fwd_bwd (__main__.TestMemoryProfilerE2E)": ["", ["A2"]], | ||
| 30778 | - "test_memory_timeline (__main__.TestMemoryProfilerE2E)": ["", ["A2"]], | ||
| 30779 | "test_extract_gradients_from_optimizer_set_to_none (__main__.TestIdentifyGradients)": ["", [""]], | 30776 | "test_extract_gradients_from_optimizer_set_to_none (__main__.TestIdentifyGradients)": ["", [""]], |
| 30780 | "test_custom_op_fallthrough (__main__.TestUtilityFuns_opset_10)": ["", [""]], | 30777 | "test_custom_op_fallthrough (__main__.TestUtilityFuns_opset_10)": ["", [""]], |
| 30781 | "test_custom_op_fallthrough (__main__.TestUtilityFuns_opset_11)": ["", [""]], | 30778 | "test_custom_op_fallthrough (__main__.TestUtilityFuns_opset_11)": ["", [""]], |