MCPcopy Index your code
hub / github.com/pytorch/pytorch / context

Method context

caffe2/python/net_printer.py:166–178  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

164
165 @contextmanager
166 def context(self, text):
167 if text is not None:
168 self.add('with %s:' % text)
169 self._indent += 4
170 self._lines_in_context.append(0)
171 try:
172 yield
173 finally:
174 if text is not None:
175 if self._lines_in_context[-1] == 0:
176 self.add('pass')
177 self._indent -= 4
178 del self._lines_in_context[-1]
179
180 def add(self, text):
181 self._lines_in_context[-1] += 1

Callers 5

print_opFunction · 0.45
print_stepFunction · 0.45
print_taskFunction · 0.45
print_task_groupFunction · 0.45
print_jobFunction · 0.45

Calls 2

addMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected