From 38c16ff7c9bfb95248de0d3fe75b418f646acbac Mon Sep 17 00:00:00 2001 From: yelihua Date: Thu, 19 Nov 2020 19:51:33 +0800 Subject: [PATCH] add tensor statistics even if the tensor value is big --- mindinsight/debugger/stream_cache/node_type_identifier.py | 4 +++- mindinsight/debugger/stream_cache/tensor.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mindinsight/debugger/stream_cache/node_type_identifier.py b/mindinsight/debugger/stream_cache/node_type_identifier.py index f20873b4..66bffd1f 100644 --- a/mindinsight/debugger/stream_cache/node_type_identifier.py +++ b/mindinsight/debugger/stream_cache/node_type_identifier.py @@ -123,7 +123,9 @@ def is_gradient_node(node): Returns: bool, if the node is gradient type. """ - if node.name.startswith('Gradients/') and node.type != NodeTypeEnum.PARAMETER.value: + node_name = node.name.lower() + if node_name.startswith('gradients/') and \ + node.type not in [NodeTypeEnum.PARAMETER.value, NodeTypeEnum.CONST.value]: return True return False diff --git a/mindinsight/debugger/stream_cache/tensor.py b/mindinsight/debugger/stream_cache/tensor.py index 53711012..1f31ce2f 100644 --- a/mindinsight/debugger/stream_cache/tensor.py +++ b/mindinsight/debugger/stream_cache/tensor.py @@ -174,6 +174,7 @@ class OpTensor(BaseTensor): res['value'] = tensor_value.tolist() elif isinstance(tensor_value, str): res['value'] = tensor_value + res['statistics'] = TensorUtils.get_overall_statistic_dict(self._stats) return res