MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / __init__

Method __init__

tensorflow/python/debug/lib/debug_data.py:285–331  ·  view source on GitHub ↗

`DebugTensorDatum` constructor. Args: dump_root: (`str`) Debug dump root directory. This path should not include the path component that represents the device name (see also below). debug_dump_rel_path: (`str`) Path to a debug dump file, relative to the `dump_root`.

(self, dump_root, debug_dump_rel_path)

Source from the content-addressed store, hash-verified

283 """
284
285 def __init__(self, dump_root, debug_dump_rel_path):
286 """`DebugTensorDatum` constructor.
287
288 Args:
289 dump_root: (`str`) Debug dump root directory. This path should not include
290 the path component that represents the device name (see also below).
291 debug_dump_rel_path: (`str`) Path to a debug dump file, relative to the
292 `dump_root`. The first item of this relative path is assumed to be
293 a path representing the name of the device that the Tensor belongs to.
294 See `device_path_to_device_name` for more details on the device path.
295 For example, suppose the debug dump root
296 directory is `/tmp/tfdbg_1` and the dump file is at
297 `/tmp/tfdbg_1/<device_path>/>ns_1/node_a_0_DebugIdentity_123456789`,
298 then the value of the debug_dump_rel_path should be
299 `<device_path>/ns_1/node_a_0_DebugIdenity_1234456789`.
300
301 Raises:
302 ValueError: If the base file name of the dump file does not conform to
303 the dump file naming pattern:
304 `node_name`_`output_slot`_`debug_op`_`timestamp`
305 """
306
307 path_components = os.path.normpath(debug_dump_rel_path).split(os.sep)
308 self._device_name = device_path_to_device_name(path_components[0])
309 base = path_components[-1]
310 if base.count("_") < 3:
311 raise ValueError(
312 "Dump file path does not conform to the naming pattern: %s" % base)
313
314 self._extended_timestamp = base.split("_")[-1]
315 # It may include an index suffix at the end if file path collision happened
316 # due to identical timestamps.
317 if "-" in self._extended_timestamp:
318 self._timestamp = int(
319 self._extended_timestamp[:self._extended_timestamp.find("-")])
320 else:
321 self._timestamp = int(self._extended_timestamp)
322
323 self._debug_op = base.split("_")[-2]
324 self._output_slot = int(base.split("_")[-3])
325
326 node_base_name = "_".join(base.split("_")[:-3])
327 self._node_name = "/".join(path_components[1:-1] + [node_base_name])
328
329 self._file_path = os.path.join(dump_root, debug_dump_rel_path)
330 self._dump_size_bytes = (gfile.Stat(self._file_path).length if
331 gfile.Exists(self._file_path) else None)
332
333 def __str__(self):
334 return "{DebugTensorDatum (%s) %s:%d @ %s @ %d}" % (self.device_name,

Callers

nothing calls this directly

Calls 7

splitMethod · 0.45
countMethod · 0.45
findMethod · 0.45
joinMethod · 0.45
StatMethod · 0.45
ExistsMethod · 0.45

Tested by

no test coverage detected