• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 Huawei Technologies Co., Ltd
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ==============================================================================
15"""
16The module DbgServices provides offline debugger APIs.
17"""
18
19from mindspore._c_expression import security
20from mindspore.offline_debug.mi_validators import check_init, check_initialize, check_add_watchpoint,\
21     check_remove_watchpoint, check_check_watchpoints, check_read_tensor_info, check_initialize_done, \
22         check_tensor_info_init, check_tensor_data_init, check_tensor_base_data_init, check_tensor_stat_data_init,\
23              check_watchpoint_hit_init, check_parameter_init
24from mindspore.offline_debug.mi_validator_helpers import replace_minus_one
25from mindspore import log as logger
26if not security.enable_security():
27    import mindspore._mindspore_offline_debug as cds
28
29
30def get_version():
31    """
32    Function to return offline Debug Services version.
33
34    Returns:
35        version (str): DbgServices version.
36
37    Examples:
38        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
39        >>> version = dbg_services.get_version()
40    """
41    if security.enable_security():
42        raise ValueError("Offline debugger is not supported in security mode. "
43                         "Please recompile mindspore without `-s on`.")
44    return cds.DbgServices().GetVersion()
45
46
47class DbgServices:
48    """
49    Offline Debug Services class.
50
51    Args:
52        dump_file_path (str): Directory where the dump files are saved.
53
54    Examples:
55        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
56        >>> d = dbg_services.DbgServices(dump_file_path="dump_file_path")
57    """
58
59    @check_init
60    def __init__(self, dump_file_path):
61        if security.enable_security():
62            raise ValueError("Offline debugger is not supported in security mode. "
63                             "Please recompile mindspore without `-s on`.")
64        logger.info("in Python __init__, file path is %s", dump_file_path)
65        self.dump_file_path = dump_file_path
66        self.dbg_instance = cds.DbgServices()
67        self.version = self.dbg_instance.GetVersion()
68        self.initialized = False
69
70    @check_initialize
71    def initialize(self, net_name, is_sync_mode=True, max_mem_usage=0):
72        """
73        Initialize Debug Service.
74
75        Args:
76            net_name (str): Network name.
77            is_sync_mode (bool): Whether to process synchronous or asynchronous dump files mode
78                                 (default: True (synchronous)).
79            max_mem_usage (int): Maximum memory size of the debugger internal tensor cache in Megabytes(MB),
80                                 (default: 0 (disable memory restriction feature)).
81
82        Returns:
83            Initialized Debug Service instance.
84
85        Examples:
86        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
87        >>> d = dbg_services.DbgServices(dump_file_path="dump_file_path")
88        >>> d_init = d.initialize(net_name="network name", is_sync_mode=True, max_mem_usage=4096)
89        """
90        logger.info("in Python Initialize dump_file_path %s", self.dump_file_path)
91        self.initialized = True
92        return self.dbg_instance.Initialize(net_name, self.dump_file_path, is_sync_mode, max_mem_usage)
93
94    def transform_check_node_list(self, info_name, info_param, node_name, check_node_list):
95        """
96        Transforming check_node_list based on info_name and info_param.
97
98        Args:
99            info_name (str): Info name of check_node_list, either 'rank_id', 'root_graph_id' or 'is_output'
100            info_param (list[int]): Info parameters of check_node_list, mapped to info_name.
101            node_name (str): Node name as key of check_node_list.
102            check_node_list (dict): Dictionary of node names (str or '*' to check all nodes) as key,
103                                    mapping to rank_id (list of ints or '*' to check all devices),
104                                    root_graph_id (list of ints or '*' to check all graphs) and is_output (bool).
105
106        Returns:
107            Transformed check_node_list.
108
109        Examples:
110        >>> from mindspore.offline_debug import dbg_services
111        >>> d = dbg_services.DbgServices(dump_file_path="dump_file_path")
112        >>> d_init = d.initialize(is_sync_mode=True)
113        >>> d_wp = d_init.transform_check_node_list(info_name="rank_id",
114        >>>                                         info_param=[0],
115        >>>                                         node_name="conv2.bias",
116        >>>                                         check_node_list={"conv2.bias" : {"rank_id": [0],
117        >>>                                                                         root_graph_id: [0],
118        >>>                                                                         "is_output": True}})
119        """
120        if info_name in ["rank_id", "root_graph_id"]:
121            if info_param in ["*"]:
122                check_node_list[node_name][info_name] = ["*"]
123            else:
124                check_node_list[node_name][info_name] = list(map(str, info_param))
125        return check_node_list
126
127    @check_initialize_done
128    @check_add_watchpoint
129    def add_watchpoint(self, watchpoint_id, watch_condition, check_node_list, parameter_list):
130        """
131        Adding watchpoint to Debug Service instance.
132
133        Args:
134            watchpoint_id (int): Watchpoint id
135            watch_condition (int): A representation of the condition to be checked.
136            check_node_list (dict): Dictionary of node names (str or '*' to check all nodes) as key,
137                                    mapping to rank_id (list of ints or '*' to check all devices),
138                                    root_graph_id (list of ints or '*' to check all graphs) and is_output (bool).
139            parameter_list (list): List of parameters in watchpoint. Parameters should be instances of Parameter class.
140                                   Each parameter describes the value to be checked in watchpoint.
141
142        Returns:
143            Debug Service instance with added watchpoint.
144
145        Examples:
146        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
147        >>> d = dbg_services.DbgServices(dump_file_path="dump_file_path")
148        >>> d_init = d.initialize(is_sync_mode=True)
149        >>> d_wp = d_init.add_watchpoint(watchpoint_id=1,
150        ...                              watch_condition=6,
151        ...                              check_node_list={"conv2.bias" : {"rank_id": [0],
152        ...                                                               root_graph_id: [0], "is_output": True}},
153        ...                              parameter_list=[dbg_services.Parameter(name="param",
154        ...                                                                     disabled=False,
155        ...                                                                     value=0.0,
156        ...                                                                     hit=False,
157        ...                                                                     actual_value=0.0)])
158        """
159        logger.info("in Python AddWatchpoint")
160        for node_name, node_info in check_node_list.items():
161            for info_name, info_param in node_info.items():
162                check_node_list = self.transform_check_node_list(info_name, info_param, node_name, check_node_list)
163        parameter_list_inst = []
164        for elem in parameter_list:
165            parameter_list_inst.append(elem.instance)
166        return self.dbg_instance.AddWatchpoint(watchpoint_id, watch_condition, check_node_list, parameter_list_inst)
167
168    @check_initialize_done
169    @check_remove_watchpoint
170    def remove_watchpoint(self, watchpoint_id):
171        """
172        Removing watchpoint from Debug Service instance.
173
174        Args:
175            watchpoint_id (int): Watchpoint id.
176
177        Returns:
178            Debug Service instance with removed watchpoint.
179
180        Examples:
181        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
182        >>> d = dbg_services.DbgServices(dump_file_path="dump_file_path")
183        >>> d_init = d.initialize(is_sync_mode=True)
184        >>> d_wp = d_init.add_watchpoint(watchpoint_id=1,
185        ...                              watch_condition=6,
186        ...                              check_node_list={"conv2.bias" : {"rank_id": [0],
187        ...                                                               root_graph_id: [0], "is_output": True}},
188        ...                              parameter_list=[dbg_services.Parameter(name="param",
189        ...                                                                     disabled=False,
190        ...                                                                     value=0.0,
191        ...                                                                     hit=False,
192        ...                                                                     actual_value=0.0)])
193        >>> d_wp = d_wp.remove_watchpoint(watchpoint_id=1)
194        """
195        logger.info("in Python Remove Watchpoint id %d", watchpoint_id)
196        return self.dbg_instance.RemoveWatchpoint(watchpoint_id)
197
198    @check_initialize_done
199    @check_check_watchpoints
200    def check_watchpoints(self, iteration):
201        """
202        Checking watchpoint at given iteration.
203
204        Args:
205            iteration (int): Watchpoint check iteration.
206
207        Returns:
208            Watchpoint hit list.
209
210        Examples:
211        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
212        >>> d = dbg_services.DbgServices(dump_file_path="dump_file_path")
213        >>> d_init = d.initialize(is_sync_mode=True)
214        >>> d_wp = d_init.add_watchpoint(id=1,
215        ...                              watch_condition=6,
216        ...                              check_node_list={"conv2.bias" : {"rank_id": [5],
217        ...                                                               root_graph_id: [0], "is_output": True}},
218        ...                              parameter_list=[dbg_services.Parameter(name="param",
219        ...                                                                     disabled=False,
220        ...                                                                     value=0.0,
221        ...                                                                     hit=False,
222        ...                                                                     actual_value=0.0)])
223        >>> watchpoints = d_wp.check_watchpoints(iteration=8)
224        """
225        logger.info("in Python CheckWatchpoints iteration %d", iteration)
226        iteration = replace_minus_one(iteration)
227        watchpoint_list = self.dbg_instance.CheckWatchpoints(iteration)
228        watchpoint_hit_list = []
229        for watchpoint in watchpoint_list:
230            name = watchpoint.get_name()
231            slot = watchpoint.get_slot()
232            condition = watchpoint.get_condition()
233            watchpoint_id = watchpoint.get_watchpoint_id()
234            parameters = watchpoint.get_parameters()
235            error_code = watchpoint.get_error_code()
236            rank_id = watchpoint.get_rank_id()
237            root_graph_id = watchpoint.get_root_graph_id()
238            param_list = []
239            for param in parameters:
240                p_name = param.get_name()
241                disabled = param.get_disabled()
242                value = param.get_value()
243                hit = param.get_hit()
244                actual_value = param.get_actual_value()
245                param_list.append(Parameter(p_name, disabled, value, hit, actual_value))
246            watchpoint_hit_list.append(WatchpointHit(name, slot, condition, watchpoint_id,
247                                                     param_list, error_code, rank_id, root_graph_id))
248        return watchpoint_hit_list
249
250    @check_initialize_done
251    @check_read_tensor_info
252    def read_tensors(self, info):
253        """
254        Returning tensor data object describing the tensor requested tensor.
255
256        Args:
257            info (list): List of TensorInfo objects.
258
259        Returns:
260            TensorData list (list).
261
262        Examples:
263        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
264        >>> d = dbg_services.DbgServices(dump_file_path="dump_file_path")
265        >>> d_init = d.initialize(is_sync_mode=True)
266        >>> tensor_data_list = d_init.read_tensors([dbg_services.TensorInfo(node_name="conv2.bias",
267        ...                                                                 slot=0,
268        ...                                                                 iteration=8,
269        ...                                                                 rank_id=5,
270        ...                                                                 root_graph_id=0,
271        ...                                                                 is_output=True)])
272        """
273        logger.info("in Python ReadTensors info:")
274        logger.info(info)
275        info_list_inst = []
276        for elem in info:
277            logger.info("in Python ReadTensors info:")
278            logger.info(info)
279            info_list_inst.append(elem.instance)
280        tensor_data_list = self.dbg_instance.ReadTensors(info_list_inst)
281        tensor_data_list_ret = []
282        for elem in tensor_data_list:
283            if elem.get_data_size() == 0:
284                tensor_data = TensorData(b'', elem.get_data_size(), elem.get_dtype(), elem.get_shape())
285            else:
286                tensor_data = TensorData(elem.get_data_ptr(), elem.get_data_size(), elem.get_dtype(), elem.get_shape())
287            tensor_data_list_ret.append(tensor_data)
288        return tensor_data_list_ret
289
290    @check_initialize_done
291    @check_read_tensor_info
292    def read_tensor_base(self, info):
293        """
294        Returning tensor base data object describing the requested tensor.
295
296        Args:
297            info (list): List of TensorInfo objects.
298
299        Returns:
300            list, TensorBaseData list.
301
302        Examples:
303        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
304        >>> d = dbg_services.DbgServices(dump_file_path="dump_file_path")
305        >>> d_init = d.initialize(is_sync_mode=True)
306        >>> tensor_base_data_list = d_init.read_tensor_base([dbg_services.TensorInfo(node_name="conv2.bias",
307        ...                                                                          slot=0,
308        ...                                                                          iteration=8,
309        ...                                                                          rank_id=5,
310        ...                                                                          root_graph_id=0,
311        ...                                                                          is_output=True)])
312        """
313        logger.info("in Python ReadTensorsBase info:")
314        logger.info(info)
315        info_list_inst = []
316        for elem in info:
317            logger.info("in Python ReadTensorsBase info:")
318            logger.info(info)
319            info_list_inst.append(elem.instance)
320        tensor_base_data_list = self.dbg_instance.ReadTensorsBase(info_list_inst)
321        tensor_base_data_list_ret = []
322        for elem in tensor_base_data_list:
323            tensor_base_data = TensorBaseData(elem.data_size(), elem.dtype(), elem.shape())
324            tensor_base_data_list_ret.append(tensor_base_data)
325        return tensor_base_data_list_ret
326
327    @check_initialize_done
328    @check_read_tensor_info
329    def read_tensor_stats(self, info):
330        """
331        Returning tensor statistics object describing the requested tensor.
332
333        Args:
334            info (list): List of TensorInfo objects.
335
336        Returns:
337            list, TensorStatData list.
338
339        Examples:
340        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
341        >>> d = dbg_services.DbgServices(dump_file_path="dump_file_path")
342        >>> d_init = d.initialize(is_sync_mode=True)
343        >>> tensor_stat_data_list = d_init.read_tensor_stats([dbg_services.TensorInfo(node_name="conv2.bias",
344        ...                                                                           slot=0,
345        ...                                                                           iteration=8,
346        ...                                                                           rank_id=5,
347        ...                                                                           root_graph_id=0,
348        ...                                                                           is_output=True)])
349        """
350        logger.info("in Python ReadTensorsStat info:")
351        logger.info(info)
352        info_list_inst = []
353        for elem in info:
354            logger.info("in Python ReadTensorsStat info:")
355            logger.info(info)
356            info_list_inst.append(elem.instance)
357        tensor_stat_data_list = self.dbg_instance.ReadTensorsStat(info_list_inst)
358        tensor_stat_data_list_ret = []
359        for elem in tensor_stat_data_list:
360            tensor_stat_data = TensorStatData(elem.data_size(), elem.dtype(),
361                                              elem.shape(), elem.is_bool(),
362                                              elem.max_value(), elem.min_value(),
363                                              elem.avg_value(), elem.count(), elem.neg_zero_count(),
364                                              elem.pos_zero_count(), elem.nan_count(), elem.neg_inf_count(),
365                                              elem.pos_inf_count(), elem.zero_count())
366            tensor_stat_data_list_ret.append(tensor_stat_data)
367        return tensor_stat_data_list_ret
368
369
370class TensorInfo:
371    """
372    Tensor Information class.
373
374    Args:
375        node_name (str): Fully qualified name of the desired node.
376        slot (int): The particular output for the requested node.
377        iteration (int): The desired itraretion to gather tensor information.
378        rank_id (int): The desired rank id to gather tensor information.
379        is_output (bool): Whether node is an output or input.
380
381    Examples:
382        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
383        >>> tensor_info = dbg_services.TensorInfo(node_name="conv2.bias",
384        ...                                       slot=0,
385        ...                                       iteration=8,
386        ...                                       rank_id=5,
387        ...                                       root_graph_id=0,
388        ...                                       is_output=True)
389    """
390    @check_tensor_info_init
391    def __init__(self, node_name, slot, iteration, rank_id, root_graph_id, is_output=True):
392        if security.enable_security():
393            raise ValueError("Offline debugger is not supported in security mode. "
394                             "Please recompile mindspore without `-s on`.")
395        iteration = replace_minus_one(iteration)
396        self.instance = cds.tensor_info(node_name, slot, iteration, rank_id, root_graph_id, is_output)
397
398    @property
399    def node_name(self):
400        """
401        Function to receive TensorInfo node_name.
402
403        Returns:
404            node_name of TensorInfo instance (str).
405
406        Examples:
407            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
408            >>> tensor_info = dbg_services.TensorInfo(node_name="conv2.bias",
409            ...                                       slot=0,
410            ...                                       iteration=8,
411            ...                                       rank_id=5,
412            ...                                       root_graph_id=0,
413            ...                                       is_output=True)
414            >>> name = tensor_info.node_name
415        """
416        return self.instance.get_node_name()
417
418    @property
419    def slot(self):
420        """
421        Function to receive TensorInfo slot.
422
423        Returns:
424            slot of TensorInfo instance (int).
425
426        Examples:
427            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
428            >>> tensor_info = dbg_services.TensorInfo(node_name="conv2.bias",
429            ...                                       slot=0,
430            ...                                       iteration=8,
431            ...                                       rank_id=5,
432            ...                                       root_graph_id=0,
433            ...                                       is_output=True)
434            >>> slot = tensor_info.slot
435        """
436        return self.instance.get_slot()
437
438    @property
439    def iteration(self):
440        """
441        Function to receive TensorInfo iteration.
442
443        Returns:
444            iteration of TensorInfo instance (int).
445
446        Examples:
447            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
448            >>> tensor_info = dbg_services.TensorInfo(node_name="conv2.bias",
449            ...                                       slot=0,
450            ...                                       iteration=8,
451            ...                                       rank_id=5,
452            ...                                       root_graph_id=0,
453            ...                                       is_output=True)
454            >>> iteration = tensor_info.iteration
455        """
456        return self.instance.get_iteration()
457
458    @property
459    def rank_id(self):
460        """
461        Function to receive TensorInfo rank_id.
462
463        Returns:
464            rank_id of TensorInfo instance (int).
465
466        Examples:
467            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
468            >>> tensor_info = dbg_services.TensorInfo(node_name="conv2.bias",
469            ...                                       slot=0,
470            ...                                       iteration=8,
471            ...                                       rank_id=5,
472            ...                                       root_graph_id=0,
473            ...                                       is_output=True)
474            >>> rank_id = tensor_info.rank_id
475        """
476        return self.instance.get_rank_id()
477
478    @property
479    def root_graph_id(self):
480        """
481        Function to receive TensorInfo root_graph_id.
482
483        Returns:
484            root_graph_id of TensorInfo instance (int).
485
486        Examples:
487            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
488            >>> tensor_info = dbg_services.TensorInfo(node_name="conv2.bias",
489            ...                                       slot=0,
490            ...                                       iteration=8,
491            ...                                       rank_id=5,
492            ...                                       root_graph_id=0,
493            ...                                       is_output=True)
494            >>> rank_id = tensor_info.root_graph_id
495        """
496        return self.instance.get_root_graph_id()
497
498    @property
499    def is_output(self):
500        """
501        Function to receive TensorInfo is_output.
502
503        Returns:
504            is_output of TensorInfo instance (bool).
505
506        Examples:
507            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
508            >>> tensor_info = dbg_services.TensorInfo(node_name="conv2.bias",
509            ...                                       slot=0,
510            ...                                       iteration=8,
511            ...                                       rank_id=5,
512            ...                                       root_graph_id=0,
513            ...                                       is_output=True)
514            >>> is_output = tensor_info.is_output
515        """
516        return self.instance.get_is_output()
517
518
519class TensorData:
520    """
521    TensorData class.
522
523    Args:
524        data_ptr (byte): Data pointer.
525        data_size (int): Size of data in bytes.
526        dtype (int): An encoding representing the type of TensorData.
527        shape (list): Shape of tensor.
528
529    Examples:
530        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
531        >>> tensor_data = dbg_services.TensorData(data_ptr=b'\xba\xd0\xba\xd0',
532        ...                                       data_size=4,
533        ...                                       dtype=0,
534        ...                                       shape=[2, 2])
535    """
536    @check_tensor_data_init
537    def __init__(self, data_ptr, data_size, dtype, shape):
538        if security.enable_security():
539            raise ValueError("Offline debugger is not supported in security mode."
540                             "Please recompile mindspore without `-s on`.")
541        self.instance = cds.tensor_data(data_ptr, data_size, dtype, shape)
542
543    @property
544    def data_ptr(self):
545        """
546        Function to receive TensorData data_ptr.
547
548        Returns:
549            data_ptr of TensorData instance (byte).
550
551        Examples:
552            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
553            >>> tensor_data = dbg_services.TensorData(data_ptr=b'\xba\xd0\xba\xd0',
554            ...                                       data_size=4,
555            ...                                       dtype=0,
556            ...                                       shape=[2, 2])
557            >>> data_ptr = tensor_data.data_ptr
558        """
559        return self.instance.get_data_ptr()
560
561    @property
562    def data_size(self):
563        """
564        Function to receive TensorData data_size.
565
566        Returns:
567            data_size of TensorData instance (int).
568
569        Examples:
570            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
571            >>> tensor_data = dbg_services.TensorData(data_ptr=b'\xba\xd0\xba\xd0',
572            ...                                       data_size=4,
573            ...                                       dtype=0,
574            ...                                       shape=[2, 2])
575            >>> data_size = tensor_data.data_size
576        """
577        return self.instance.get_data_size()
578
579    @property
580    def dtype(self):
581        """
582        Function to receive TensorData dtype.
583
584        Returns:
585            dtype of TensorData instance (int).
586
587        Examples:
588            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
589            >>> tensor_data = dbg_services.TensorData(data_ptr=b'\xba\xd0\xba\xd0',
590            ...                                       data_size=4,
591            ...                                       dtype=0,
592            ...                                       shape=[2, 2])
593            >>> dtype = tensor_data.dtype
594        """
595        return self.instance.get_dtype()
596
597    @property
598    def shape(self):
599        """
600        Function to receive TensorData shape.
601
602        Returns:
603            shape of TensorData instance (list).
604
605        Examples:
606            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
607            >>> tensor_data = dbg_services.TensorData(data_ptr=b'\xba\xd0\xba\xd0',
608            ...                                       data_size=4,
609            ...                                       dtype=0,
610            ...                                       shape=[2, 2])
611            >>> shape = tensor_data.shape
612        """
613        return self.instance.get_shape()
614
615
616class TensorBaseData:
617
618    """
619    TensorBaseData class.
620
621    Args:
622        data_size (int): Size of data in bytes.
623        dtype (int): An encoding representing the type of TensorData.
624        shape (list): Shape of tensor.
625
626    Examples:
627        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
628        >>> tensor_base_data = dbg_services.TensorBaseData(data_size=4,
629        ...                                                dtype=0,
630        ...                                                shape=[2, 2])
631    """
632    @check_tensor_base_data_init
633    def __init__(self, data_size, dtype, shape):
634        if security.enable_security():
635            raise ValueError("Offline debugger is not supported in security mode. "
636                             "Please recompile mindspore without `-s on`.")
637        self.instance = cds.TensorBaseData(data_size, dtype, shape)
638
639    def __str__(self):
640        tensor_base_info = (
641            f'size in bytes = {self.data_size}\n'
642            f'debugger dtype = {self.dtype}\n'
643            f'shape = {self.shape}'
644        )
645        return tensor_base_info
646
647    @property
648    def data_size(self):
649        """
650        Function to receive TensorBaseData data_size.
651
652        Returns:
653            int, data_size of TensorBaseData instance.
654
655        Examples:
656            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
657            >>> tensor_base_data = dbg_services.TensorBaseData(data_size=4,
658            ...                                       dtype=0,
659            ...                                       shape=[2, 2])
660            >>> data_size = tensor_base_data.data_size
661        """
662        return self.instance.data_size()
663
664    @property
665    def dtype(self):
666        """
667        Function to receive TensorBaseData dtype.
668
669        Returns:
670            int, dtype of TensorBaseData instance.
671
672        Examples:
673            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
674            >>> tensor_base_data = dbg_services.TensorBaseData(data_size=4,
675            ...                                                dtype=0,
676            ...                                                shape=[2, 2])
677            >>> dtype = tensor_base_data.dtype
678        """
679
680        return self.instance.dtype()
681
682    @property
683    def shape(self):
684        """
685        Function to receive TensorBaseData shape.
686
687        Returns:
688            list, shape of TensorBaseData instance.
689
690        Examples:
691            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
692            >>> tensor_base_data = dbg_services.TensorBaseData(data_size=4,
693            ...                                       dtype=0,
694            ...                                       shape=[2, 2])
695            >>> shape = tensor_base_data.shape
696        """
697        return self.instance.shape()
698
699
700class TensorStatData:
701
702    """
703    TensorStatData class.
704
705    Args:
706        data_size (int): Size of data in bytes.
707        dtype (int): An encoding representing the type of TensorData.
708        shape (list): Shape of tensor.
709        is_bool (bool): Whether the data type is bool.
710        max_value (float): Maximum value in tensor's elements.
711        min_value (float): Minimum value in tensor's elements.
712        avg_value (float): Average value of all tensor's elements.
713        count (int): Number of elements in tensor.
714        neg_zero_count (int): Number of negative elements in tensor.
715        pos_zero_count (int): Number of positive elements in tensor.
716        nan_cout (int): Number of nan elements in tensor.
717        neg_inf_count (int): Number of negative infinity elements in tensor.
718        pos_inf_count (int): Number of positive infinity elements in tensor.
719        zero_count (int): Total number of zero elements in tensor.
720
721    Examples:
722        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
723        >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
724        ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
725        ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
726        ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
727        ...                                                zero_count = 1)
728    """
729    @check_tensor_stat_data_init
730    def __init__(self, data_size, dtype, shape, is_bool, max_value, min_value, avg_value, count,
731                 neg_zero_count, pos_zero_count, nan_count, neg_inf_count, pos_inf_count, zero_count):
732        if security.enable_security():
733            raise ValueError("Offline debugger is not supported in security mode. "
734                             "Please recompile mindspore without `-s on`.")
735        self.instance = cds.TensorStatData(data_size, dtype, shape, is_bool, max_value,
736                                           min_value, avg_value, count, neg_zero_count,
737                                           pos_zero_count, nan_count, neg_inf_count,
738                                           pos_inf_count, zero_count)
739
740    def __str__(self):
741        tensor_stats_info = (
742            f'size in bytes = {self.data_size}\n'
743            f'debugger dtype = {self.dtype}\n'
744            f'shape = {self.shape}\n'
745            f'is_bool = {self.is_bool}\n'
746            f'max_value = {self.max_value}\n'
747            f'min_value = {self.min_value}\n'
748            f'avg_value = {self.avg_value}\n'
749            f'count = {self.count}\n'
750            f'neg_zero_count = {self.neg_zero_count}\n'
751            f'pos_zero_count = {self.pos_zero_count}\n'
752            f'nan_count = {self.nan_count}\n'
753            f'neg_inf_count = {self.neg_inf_count}\n'
754            f'pos_inf_count = {self.pos_inf_count}\n'
755            f'zero_count = {self.zero_count}\n'
756            )
757        return tensor_stats_info
758
759    @property
760    def data_size(self):
761        """
762        Function to receive TensorStatData data_size.
763
764        Returns:
765            int, data_size of TensorStatData instance.
766
767        Examples:
768            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
769            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
770            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
771            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
772            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
773            ...                                                zero_count = 1)
774            >>> data_size = tensor_stat_data.data_size
775        """
776
777        return self.instance.data_size()
778
779    @property
780    def dtype(self):
781        """
782        Function to receive TensorStatData dtype.
783
784        Returns:
785            int, dtype of TensorStatData instance.
786
787        Examples:
788            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
789            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
790            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
791            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
792            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
793            ...                                                zero_count = 1)
794            >>> dtype = tensor_stat_data.dtype
795        """
796        return self.instance.dtype()
797
798    @property
799    def shape(self):
800        """
801        Function to receive TensorStatData shape.
802
803        Returns:
804            list, shape of TensorStatData instance.
805
806        Examples:
807            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
808            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
809            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
810            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
811            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
812            ...                                                zero_count = 1)
813            >>> shape = tensor_stat_data.shape
814        """
815        return self.instance.shape()
816
817    @property
818    def is_bool(self):
819        """
820        Function to receive TensorStatData is_bool.
821
822        Returns:
823            bool, Whether the tensor elements are bool.
824
825        Examples:
826            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
827            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
828            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
829            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
830            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
831            ...                                                zero_count = 1)
832            >>> is_bool = tensor_stat_data.is_bool
833        """
834        return self.instance.is_bool()
835
836    @property
837    def max_value(self):
838        """
839        Function to receive TensorStatData max_value.
840
841        Returns:
842            float, max_value of TensorStatData instance.
843
844        Examples:
845            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
846            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
847            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
848            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
849            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
850            ...                                                zero_count = 1)
851            >>> max_value = tensor_stat_data.max_value
852        """
853        return self.instance.max_value()
854
855    @property
856    def min_value(self):
857        """
858        Function to receive TensorStatData min_value.
859
860        Returns:
861            float, min_value of TensorStatData instance.
862
863        Examples:
864            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
865            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
866            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
867            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
868            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
869            ...                                                zero_count = 1)
870            >>> min_value = tensor_stat_data.min_value
871        """
872        return self.instance.min_value()
873
874    @property
875    def avg_value(self):
876        """
877        Function to receive TensorStatData avg_value.
878
879        Returns:
880            float, avg_value of TensorStatData instance.
881
882        Examples:
883            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
884            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
885            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
886            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
887            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
888            ...                                                zero_count = 1)
889            >>> avg_value = tensor_stat_data.avg_value
890        """
891        return self.instance.avg_value()
892
893    @property
894    def count(self):
895        """
896        Function to receive TensorStatData count.
897
898        Returns:
899            int, count of TensorStatData instance.
900
901        Examples:
902            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
903            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
904            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
905            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
906            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
907            ...                                                zero_count = 1)
908            >>> count = tensor_stat_data.count
909        """
910        return self.instance.count()
911
912    @property
913    def neg_zero_count(self):
914        """
915        Function to receive TensorStatData neg_zero_count.
916
917        Returns:
918            int, neg_zero_count of TensorStatData instance.
919
920        Examples:
921            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
922            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
923            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
924            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
925            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
926            ...                                                zero_count = 1)
927            >>> neg_zero_count = tensor_stat_data.neg_zero_count
928        """
929        return self.instance.neg_zero_count()
930
931    @property
932    def pos_zero_count(self):
933        """
934        Function to receive TensorStatData pos_zero_count.
935
936        Returns:
937            int, pos_zero_count of TensorStatData instance.
938
939        Examples:
940            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
941            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
942            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
943            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
944            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
945            ...                                                zero_count = 1)
946            >>> pos_zero_count = tensor_stat_data.pos_zero_count
947        """
948        return self.instance.pos_zero_count()
949
950    @property
951    def zero_count(self):
952        """
953        Function to receive TensorStatData zero_count.
954
955        Returns:
956            int, zero_count of TensorStatData instance.
957
958        Examples:
959            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
960            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
961            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
962            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
963            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
964            ...                                                zero_count = 1)
965            >>> zero_count = tensor_stat_data.zero_count
966        """
967        return self.instance.zero_count()
968
969    @property
970    def nan_count(self):
971        """
972        Function to receive TensorStatData nan_count.
973
974        Returns:
975            int, nan_count of TensorStatData instance.
976
977        Examples:
978            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
979            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
980            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
981            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
982            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
983            ...                                                zero_count = 1)
984            >>> nan_count = tensor_stat_data.nan_count
985        """
986        return self.instance.nan_count()
987
988    @property
989    def neg_inf_count(self):
990        """
991        Function to receive TensorStatData shape.
992
993        Returns:
994            int, neg_inf_count of TensorStatData instance.
995
996        Examples:
997            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
998            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
999            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
1000            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
1001            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
1002            ...                                                zero_count = 1)
1003            >>> neg_inf_count = tensor_stat_data.neg_inf_count
1004        """
1005        return self.instance.neg_inf_count()
1006
1007    @property
1008    def pos_inf_count(self):
1009        """
1010        Function to receive TensorStatData pos_inf_count.
1011
1012        Returns:
1013            pos_inf_count of TensorStatData instance (int).
1014
1015        Examples:
1016            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1017            >>> tensor_stat_data = dbg_services.TensorStatData(data_size=4, dtype=0, shape=[2, 2], is_bool = false,
1018            ...                                                max_value = 10.0, min_value = 0.0, avg_value = 5.0,
1019            ...                                                count = 4, neg_zero_count = 0, pos_zero_count = 4,
1020            ...                                                nan_count = 0, neg_inf_count = 0, pos_inf_count = 0,
1021            ...                                                zero_count = 1)
1022            >>> pos_inf_count = tensor_stat_data.pos_inf_count
1023        """
1024        return self.instance.pos_inf_count()
1025
1026
1027class WatchpointHit:
1028    """
1029    WatchpointHit class.
1030
1031    Args:
1032        name (str): Name of WatchpointHit instance.
1033        slot (int): The numerical label of an output.
1034        condition (int): A representation of the condition to be checked.
1035        watchpoint_id (int): Watchpoint id.
1036        parameters (list): A list of all parameters for WatchpointHit instance.
1037                           Parameters have to be instances of Parameter class.
1038        error_code (int): An explanation of certain scenarios where watchpoint could not be checked.
1039        rank_id (int): Rank id where the watchpoint is hit.
1040        root_graph_id (int): Root graph id where the watchpoint is hit.
1041
1042    Examples:
1043        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1044        >>> watchpoint_hit = dbg_services.WatchpointHit(name="hit1",
1045        ...                                             slot=1,
1046        ...                                             condition=2,
1047        ...                                             watchpoint_id=3,
1048        ...                                             parameters=[param1, param2],
1049        ...                                             error_code=0,
1050        ...                                             rank_id=1,
1051        ...                                             root_graph_id=1)
1052    """
1053
1054    @check_watchpoint_hit_init
1055    def __init__(self, name, slot, condition, watchpoint_id, parameters, error_code, rank_id, root_graph_id):
1056        if security.enable_security():
1057            raise ValueError("Offline debugger is not supported in security mode. "
1058                             "Please recompile mindspore without `-s on`.")
1059        parameter_list_inst = []
1060        for elem in parameters:
1061            parameter_list_inst.append(elem.instance)
1062        self.instance = cds.watchpoint_hit(name, slot, condition, watchpoint_id,
1063                                           parameter_list_inst, error_code, rank_id, root_graph_id)
1064
1065    @property
1066    def name(self):
1067        """
1068        Function to receive WatchpointHit name.
1069
1070        Returns:
1071            name of WatchpointHit instance (str).
1072
1073        Examples:
1074            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1075            >>> watchpoint_hit = dbg_services.WatchpointHit(name="hit1",
1076            ...                                             slot=1,
1077            ...                                             condition=2,
1078            ...                                             watchpoint_id=3,
1079            ...                                             parameters=[param1, param2],
1080            ...                                             error_code=0,
1081            ...                                             rank_id=1,
1082            ...                                             root_graph_id=1)
1083            >>> name = watchpoint_hit.name
1084        """
1085        return self.instance.get_name()
1086
1087    @property
1088    def slot(self):
1089        """
1090        Function to receive WatchpointHit slot.
1091
1092        Returns:
1093            slot of WatchpointHit instance (int).
1094
1095        Examples:
1096            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1097            >>> watchpoint_hit = dbg_services.WatchpointHit(name="hit1",
1098            ...                                             slot=1,
1099            ...                                             condition=2,
1100            ...                                             watchpoint_id=3,
1101            ...                                             parameters=[param1, param2],
1102            ...                                             error_code=0,
1103            ...                                             rank_id=1,
1104            ...                                             root_graph_id=1)
1105            >>> slot = watchpoint_hit.slot
1106        """
1107        return self.instance.get_slot()
1108
1109    @property
1110    def condition(self):
1111        """
1112        Function to receive WatchpointHit condition.
1113
1114        Returns:
1115            condition of WatchpointHit instance (int).
1116
1117        Examples:
1118            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1119            >>> watchpoint_hit = dbg_services.WatchpointHit(name="hit1",
1120            ...                                             slot=1,
1121            ...                                             condition=2,
1122            ...                                             watchpoint_id=3,
1123            ...                                             parameters=[param1, param2],
1124            ...                                             error_code=0,
1125            ...                                             rank_id=1,
1126            ...                                             root_graph_id=1)
1127            >>> condition = watchpoint_hit.condition
1128        """
1129        return self.instance.get_condition()
1130
1131    @property
1132    def watchpoint_id(self):
1133        """
1134        Function to receive WatchpointHit watchpoint_id.
1135
1136        Returns:
1137            watchpoint_id of WatchpointHit instance (int).
1138
1139        Examples:
1140            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1141            >>> watchpoint_hit = dbg_services.WatchpointHit(name="hit1",
1142            ...                                             slot=1,
1143            ...                                             condition=2,
1144            ...                                             watchpoint_id=3,
1145            ...                                             parameters=[param1, param2],
1146            ...                                             error_code=0,
1147            ...                                             rank_id=1,
1148            ...                                             root_graph_id=1)
1149            >>> watchpoint_id = watchpoint_hit.watchpoint_id
1150        """
1151
1152        return self.instance.get_watchpoint_id()
1153
1154    @property
1155    def parameters(self):
1156        """
1157        Function to receive WatchpointHit parameters.
1158
1159        Returns:
1160            List of parameters of WatchpointHit instance (list).
1161
1162        Examples:
1163            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1164            >>> watchpoint_hit = dbg_services.WatchpointHit(name="hit1",
1165            ...                                             slot=1,
1166            ...                                             condition=2,
1167            ...                                             watchpoint_id=3,
1168            ...                                             parameters=[param1, param2],
1169            ...                                             error_code=0,
1170            ...                                             rank_id=1,
1171            ...                                             root_graph_id=1)
1172            >>> parameters = watchpoint_hit.parameters
1173        """
1174        params = self.instance.get_parameters()
1175        param_list = []
1176        for elem in params:
1177            tmp = Parameter(elem.get_name(),
1178                            elem.get_disabled(),
1179                            elem.get_value(),
1180                            elem.get_hit(),
1181                            elem.get_actual_value())
1182            param_list.append(tmp)
1183        return param_list
1184
1185    @property
1186    def error_code(self):
1187        """
1188        Function to receive WatchpointHit error_code.
1189
1190        Returns:
1191            error_code of WatchpointHit instance (int).
1192
1193        Examples:
1194            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1195            >>> watchpoint_hit = dbg_services.WatchpointHit(name="hit1",
1196            ...                                             slot=1,
1197            ...                                             condition=2,
1198            ...                                             watchpoint_id=3,
1199            ...                                             parameters=[param1, param2],
1200            ...                                             error_code=0,
1201            ...                                             rank_id=1,
1202            ...                                             root_graph_id=1)
1203            >>> error_code = watchpoint_hit.error_code
1204        """
1205        return self.instance.get_error_code()
1206
1207    @property
1208    def rank_id(self):
1209        """
1210        Function to receive WatchpointHit rank_id.
1211
1212        Returns:
1213            rank_id of WatchpointHit instance (int).
1214
1215        Examples:
1216            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1217            >>> watchpoint_hit = dbg_services.WatchpointHit(name="hit1",
1218            ...                                             slot=1,
1219            ...                                             condition=2,
1220            ...                                             watchpoint_id=3,
1221            ...                                             parameters=[param1, param2],
1222            ...                                             error_code=0,
1223            ...                                             rank_id=1,
1224            ...                                             root_graph_id=1)
1225            >>> rank_id = watchpoint_hit.rank_id
1226        """
1227        return self.instance.get_rank_id()
1228
1229    @property
1230    def root_graph_id(self):
1231        """
1232        Function to receive WatchpointHit root_graph_id.
1233
1234        Returns:
1235            root_graph_id of WatchpointHit instance (int).
1236
1237        Examples:
1238            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1239            >>> watchpoint_hit = dbg_services.WatchpointHit(name="hit1",
1240            ...                                             slot=1,
1241            ...                                             condition=2,
1242            ...                                             watchpoint_id=3,
1243            ...                                             parameters=[param1, param2],
1244            ...                                             error_code=0,
1245            ...                                             rank_id=1,
1246            ...                                             root_graph_id=1)
1247            >>> root_graph_id = watchpoint_hit.root_graph_id
1248        """
1249        return self.instance.get_root_graph_id()
1250
1251
1252class Parameter:
1253    """
1254    Parameter class.
1255
1256    Args:
1257        name (str): Name of the parameter.
1258        disabled (bool): Whether parameter is used in backend.
1259        value (float): Threshold value of the parameter.
1260        hit (bool): Whether this parameter triggered watchpoint (default is False).
1261        actual_value (float): Actual value of the parameter (default is 0.0).
1262
1263    Examples:
1264        >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1265        >>> parameter = dbg_services.Parameter(name="param",
1266        ...                                    disabled=False,
1267        ...                                    value=0.0,
1268        ...                                    hit=False,
1269        ...                                    actual_value=0.0)
1270    """
1271    @check_parameter_init
1272    def __init__(self, name, disabled, value, hit=False, actual_value=0.0):
1273        if security.enable_security():
1274            raise ValueError("Offline debugger is not supported in security mode. "
1275                             "Please recompile mindspore without `-s on`.")
1276        self.instance = cds.parameter(name, disabled, value, hit, actual_value)
1277
1278    @property
1279    def name(self):
1280        """
1281        Function to receive Parameter name.
1282
1283        Returns:
1284            name of Parameter instance (str).
1285
1286        Examples:
1287            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1288            >>> parameter = dbg_services.Parameter(name="param",
1289            ...                                    disabled=False,
1290            ...                                    value=0.0,
1291            ...                                    hit=False,
1292            ...                                    actual_value=0.0)
1293            >>> name = watchpoint_hit.name
1294        """
1295
1296        return self.instance.get_name()
1297
1298    @property
1299    def disabled(self):
1300        """
1301        Function to receive Parameter disabled value.
1302
1303        Returns:
1304            disabled of Parameter instance (bool).
1305
1306        Examples:
1307            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1308            >>> parameter = dbg_services.Parameter(name="param",
1309            ...                                    disabled=False,
1310            ...                                    value=0.0,
1311            ...                                    hit=False,
1312            ...                                    actual_value=0.0)
1313            >>> disabled = watchpoint_hit.disabled
1314        """
1315        return self.instance.get_disabled()
1316
1317    @property
1318    def value(self):
1319        """
1320        Function to receive Parameter value.
1321
1322        Returns:
1323            value of Parameter instance (float).
1324
1325        Examples:
1326            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1327            >>> parameter = dbg_services.Parameter(name="param",
1328            ...                                    disabled=False,
1329            ...                                    value=0.0,
1330            ...                                    hit=False,
1331            ...                                    actual_value=0.0)
1332            >>> value = watchpoint_hit.value
1333        """
1334        return self.instance.get_value()
1335
1336    @property
1337    def hit(self):
1338        """
1339        Function to receive Parameter hit value.
1340
1341        Returns:
1342            hit of Parameter instance (bool).
1343
1344        Examples:
1345            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1346            >>> parameter = dbg_services.Parameter(name="param",
1347            ...                                    disabled=False,
1348            ...                                    value=0.0,
1349            ...                                    hit=False,
1350            ...                                    actual_value=0.0)
1351            >>> hit = watchpoint_hit.hit
1352        """
1353        return self.instance.get_hit()
1354
1355    @property
1356    def actual_value(self):
1357        """
1358        Function to receive Parameter actual_value value.
1359
1360        Returns:
1361            actual_value of Parameter instance (float).
1362
1363        Examples:
1364            >>> from mindspore.ccsrc.debug.debugger.offline_debug import dbg_services
1365            >>> parameter = dbg_services.Parameter(name="param",
1366            ...                                    disabled=False,
1367            ...                                    value=0.0,
1368            ...                                    hit=False,
1369            ...                                    actual_value=0.0)
1370            >>> actual_value = watchpoint_hit.actual_value
1371        """
1372        return self.instance.get_actual_value()
1373