From 03a599f12e06152dca0475869a4f2eca4befb061 Mon Sep 17 00:00:00 2001 From: RanZheng <364167184@qq.com> Date: Tue, 12 Aug 2025 17:16:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?tensor=E8=90=BD=E7=9B=98=E6=96=B0=E5=A2=9Ed?= =?UTF-8?q?ata=5Fptr=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/data_dump/data_processor/pytorch_processor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debug/accuracy_tools/msprobe/core/data_dump/data_processor/pytorch_processor.py b/debug/accuracy_tools/msprobe/core/data_dump/data_processor/pytorch_processor.py index a41417549..eff5c2e14 100644 --- a/debug/accuracy_tools/msprobe/core/data_dump/data_processor/pytorch_processor.py +++ b/debug/accuracy_tools/msprobe/core/data_dump/data_processor/pytorch_processor.py @@ -285,8 +285,9 @@ class PytorchDataProcessor(BaseDataProcessor): if self.config.async_dump: self._async_dump_cache[file_path] = tensor.clone().detach() else: - saved_tensor = tensor.clone().contiguous().detach() - save_pt(saved_tensor, file_path) + if tensor.storage().data_ptr() != 0: + saved_tensor = tensor.clone().contiguous().detach() + save_pt(saved_tensor, file_path) return single_arg def _analyze_and_save_ndarray(self, ndarray, suffix): -- Gitee From cfc3175516e30510e19c81dd88de4361a57ceec9 Mon Sep 17 00:00:00 2001 From: RanZheng <364167184@qq.com> Date: Wed, 13 Aug 2025 09:48:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/data_dump/data_processor/pytorch_processor.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/debug/accuracy_tools/msprobe/core/data_dump/data_processor/pytorch_processor.py b/debug/accuracy_tools/msprobe/core/data_dump/data_processor/pytorch_processor.py index ed3e107c0..c3d6ebe5e 100644 --- a/debug/accuracy_tools/msprobe/core/data_dump/data_processor/pytorch_processor.py +++ b/debug/accuracy_tools/msprobe/core/data_dump/data_processor/pytorch_processor.py @@ -319,17 +319,16 @@ class PytorchDataProcessor(BaseDataProcessor): def _analyze_and_save_tensor(self, tensor, suffix): dump_data_name, file_path = self.get_save_file_path(suffix) single_arg = PytorchDataProcessor._analyze_tensor(self, tensor, suffix) - if self.tensor_handler.is_empty_data(tensor): - logger.debug("Collecting real data of fake tensor or meta tensor is not supported.") + if self.tensor_handler.is_empty_data(tensor) or tensor.storage().data_ptr() == 0: + logger.debug("Collecting real data of fake tensor or meta tensor is not supported or data_ptr is 0.") return single_arg single_arg.update({"data_name": dump_data_name}) if self.config.async_dump: self._async_dump_cache[file_path] = tensor.clone().detach() else: - if tensor.storage().data_ptr() != 0: - saved_tensor = tensor.clone().contiguous().detach() - save_pt(saved_tensor, file_path) + saved_tensor = tensor.clone().contiguous().detach() + save_pt(saved_tensor, file_path) return single_arg def _analyze_and_save_ndarray(self, ndarray, suffix): -- Gitee