MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / write

Method write

detectron2/utils/events.py:104–124  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

102 self._last_write = -1
103
104 def write(self):
105 storage = get_event_storage()
106 to_save = defaultdict(dict)
107
108 for k, (v, iter) in storage.latest_with_smoothing_hint(self._window_size).items():
109 # keep scalars that have not been written
110 if iter <= self._last_write:
111 continue
112 to_save[iter][k] = v
113 if len(to_save):
114 all_iters = sorted(to_save.keys())
115 self._last_write = max(all_iters)
116
117 for itr, scalars_per_iter in to_save.items():
118 scalars_per_iter["iteration"] = itr
119 self._file_handle.write(json.dumps(scalars_per_iter, sort_keys=True) + "\n")
120 self._file_handle.flush()
121 try:
122 os.fsync(self._file_handle.fileno())
123 except AttributeError:
124 pass
125
126 def close(self):
127 self._file_handle.close()

Callers 15

get_versionFunction · 0.45
do_trainFunction · 0.45
after_stepMethod · 0.45
after_trainMethod · 0.45
after_stepMethod · 0.45
default_setupFunction · 0.45
processMethod · 0.45
evaluateMethod · 0.45
_eval_predictionsMethod · 0.45
_eval_predictionsMethod · 0.45
_eval_predictionsMethod · 0.45

Calls 2

get_event_storageFunction · 0.85

Tested by 1

_merge_cfg_strMethod · 0.36