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

Function load_tensor_from_event_file

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

Load a tensor from an event file. Assumes that the event file contains a `Event` protobuf and the `Event` protobuf contains a `Tensor` value. Args: event_file_path: (`str`) path to the event file. Returns: The tensor value loaded from the event file, as a `numpy.ndarray`. For

(event_file_path)

Source from the content-addressed store, hash-verified

81
82
83def load_tensor_from_event_file(event_file_path):
84 """Load a tensor from an event file.
85
86 Assumes that the event file contains a `Event` protobuf and the `Event`
87 protobuf contains a `Tensor` value.
88
89 Args:
90 event_file_path: (`str`) path to the event file.
91
92 Returns:
93 The tensor value loaded from the event file, as a `numpy.ndarray`. For
94 uninitialized Tensors, returns `None`. For Tensors of data types that
95 cannot be converted to `numpy.ndarray` (e.g., `tf.resource`), return
96 `None`.
97 """
98
99 event = event_pb2.Event()
100 with gfile.Open(event_file_path, "rb") as f:
101 event.ParseFromString(f.read())
102 return load_tensor_from_event(event)
103
104
105def load_tensor_from_event(event):

Callers 1

get_tensorMethod · 0.85

Calls 5

load_tensor_from_eventFunction · 0.85
EventMethod · 0.45
OpenMethod · 0.45
ParseFromStringMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected