MCPcopy Create free account
hub / github.com/tensorflow/tensorboard / convert_tensors

Function convert_tensors

tensorboard/tools/convert_tbdev_export.py:155–192  ·  view source on GitHub ↗
(exp_dir, out_dir)

Source from the content-addressed store, hash-verified

153
154
155def convert_tensors(exp_dir, out_dir):
156 def convert_tensors(tensors_file_path):
157 # Exported value is a path to a .npz file, holding tensor values for all
158 # points in the entire series.
159 if os.path.dirname(tensors_file_path) != _TENSORS_DIR:
160 logging.warning(
161 "Skipping invalid tensor file path %r", tensors_file_path
162 )
163 return None
164 npz = np.load(os.path.join(exp_dir, tensors_file_path))
165 return [tensor_util.make_tensor_proto(npz[key]) for key in npz.files]
166
167 run_to_series = load_run_to_series(os.path.join(exp_dir, _TENSORS_FILE))
168 for run, series_list in run_to_series.items():
169 w = create_writer_for_run(out_dir, run, "tensors")
170 for series in series_list:
171 tag = series["tag"]
172 summary_metadata = base64.b64decode(series["summary_metadata"])
173 tensors = convert_tensors(series["points"]["tensors_file_path"])
174 if tensors is None:
175 continue
176 if len(tensors) != len(series["points"]["steps"]):
177 logging.warning(
178 "Skipping tag %r in run %r with incomplete tensor data",
179 tag,
180 run,
181 )
182 points = zip(
183 series["points"]["steps"],
184 series["points"]["wall_times"],
185 tensors,
186 )
187 for step, wall_time, tensor in points:
188 e = Event(step=step, wall_time=wall_time)
189 e.summary.value.add(tag=tag, tensor=tensor)
190 e.summary.value[0].metadata.MergeFromString(summary_metadata)
191 w.add_event(e)
192 w.close()
193
194
195def convert_blobs(exp_dir, out_dir):

Callers 1

convertFunction · 0.85

Calls 8

load_run_to_seriesFunction · 0.85
create_writer_for_runFunction · 0.85
itemsMethod · 0.80
loadMethod · 0.45
joinMethod · 0.45
addMethod · 0.45
add_eventMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…