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

Function device_path_to_device_name

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

Parse device name from device path. Args: device_dir: (str) a directory name for the device. Returns: (str) parsed device name.

(device_dir)

Source from the content-addressed store, hash-verified

255
256
257def device_path_to_device_name(device_dir):
258 """Parse device name from device path.
259
260 Args:
261 device_dir: (str) a directory name for the device.
262
263 Returns:
264 (str) parsed device name.
265 """
266 path_items = os.path.basename(device_dir)[
267 len(METADATA_FILE_PREFIX) + len(DEVICE_TAG):].split(",")
268 return "/".join([
269 path_item.replace("device_", "device:").replace("_", ":", 1)
270 for path_item in path_items])
271
272
273class DebugTensorDatum(object):

Callers 2

__init__Method · 0.85

Calls 3

replaceMethod · 0.80
splitMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected