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

Method find

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

Find dumped tensor data by a certain predicate. Args: predicate: A callable that takes two input arguments: ```python def predicate(debug_tensor_datum, tensor): # returns a bool ``` where `debug_tensor_datum` is an instance of `DebugTensorDatum`

(self,
           predicate,
           first_n=0,
           device_name=None,
           exclude_node_names=None)

Source from the content-addressed store, hash-verified

1415 return self._watch_key_to_datum[device_name].get(debug_watch_key, [])
1416
1417 def find(self,
1418 predicate,
1419 first_n=0,
1420 device_name=None,
1421 exclude_node_names=None):
1422 """Find dumped tensor data by a certain predicate.
1423
1424 Args:
1425 predicate: A callable that takes two input arguments:
1426
1427 ```python
1428 def predicate(debug_tensor_datum, tensor):
1429 # returns a bool
1430 ```
1431
1432 where `debug_tensor_datum` is an instance of `DebugTensorDatum`, which
1433 carries the metadata, such as the `Tensor`'s node name, output slot
1434 timestamp, debug op name, etc.; and `tensor` is the dumped tensor value
1435 as a `numpy.ndarray`.
1436 first_n: (`int`) return only the first n `DebugTensotDatum` instances (in
1437 time order) for which the predicate returns True. To return all the
1438 `DebugTensotDatum` instances, let first_n be <= 0.
1439 device_name: optional device name.
1440 exclude_node_names: Optional regular expression to exclude nodes with
1441 names matching the regular expression.
1442
1443 Returns:
1444 A list of all `DebugTensorDatum` objects in this `DebugDumpDir` object
1445 for which predicate returns True, sorted in ascending order of the
1446 timestamp.
1447 """
1448 if exclude_node_names:
1449 exclude_node_names = re.compile(exclude_node_names)
1450
1451 matched_data = []
1452 for device in (self._dump_tensor_data if device_name is None
1453 else (self._dump_tensor_data[device_name],)):
1454 for datum in self._dump_tensor_data[device]:
1455 if exclude_node_names and exclude_node_names.match(datum.node_name):
1456 continue
1457
1458 if predicate(datum, datum.get_tensor()):
1459 matched_data.append(datum)
1460
1461 if first_n > 0 and len(matched_data) >= first_n:
1462 return matched_data
1463
1464 return matched_data
1465
1466 def get_tensor_file_paths(self,
1467 node_name,

Callers 15

on_run_endMethod · 0.95
mainFunction · 0.45
_get_files_setFunction · 0.45
testMatchingFilesMethod · 0.45
_einsum_reductionFunction · 0.45
PrintAllPythonOpsFunction · 0.45
AddAttrForArgMethod · 0.45
CodeMethod · 0.45
GetEagerFunctionSetupMethod · 0.45

Calls 4

compileMethod · 0.45
matchMethod · 0.45
get_tensorMethod · 0.45
appendMethod · 0.45

Tested by 15

_get_files_setFunction · 0.36
testMatchingFilesMethod · 0.36
pprof_test_helperMethod · 0.36
check_selectionMethod · 0.36
_trainLoopMethod · 0.36
_extract_nodeFunction · 0.36
testGradientGraphMethod · 0.36
CheckAndRemoveDocFunction · 0.36