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)
| 81 | |
| 82 | |
| 83 | def 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 | |
| 105 | def load_tensor_from_event(event): |
no test coverage detected