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

Class ScopedWS

detectron2/export/shared.py:129–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127
128
129class ScopedWS(object):
130 def __init__(self, ws_name, is_reset, is_cleanup=False):
131 self.ws_name = ws_name
132 self.is_reset = is_reset
133 self.is_cleanup = is_cleanup
134 self.org_ws = ""
135
136 def __enter__(self):
137 self.org_ws = workspace.CurrentWorkspace()
138 if self.ws_name is not None:
139 workspace.SwitchWorkspace(self.ws_name, True)
140 if self.is_reset:
141 workspace.ResetWorkspace()
142
143 return workspace
144
145 def __exit__(self, *args):
146 if self.is_cleanup:
147 workspace.ResetWorkspace()
148 if self.ws_name is not None:
149 workspace.SwitchWorkspace(self.org_ws)
150
151
152def fetch_any_blob(name):

Callers 4

__init__Method · 0.85
forwardMethod · 0.85
get_params_from_init_netFunction · 0.85
run_and_save_graphFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected