MCPcopy Create free account
hub / github.com/pytorch/pytorch / get_active

Method get_active

caffe2/python/context.py:28–35  ·  view source on GitHub ↗
(self, required=True)

Source from the content-addressed store, hash-verified

26 assert self._stack.pop() == value
27
28 def get_active(self, required=True):
29 if len(self._stack) == 0:
30 if not required:
31 return None
32 assert self.allow_default, (
33 'Context %s is required but none is active.' % self.cls)
34 self.enter(self.cls())
35 return self._stack[-1]
36
37
38class _ContextRegistry:

Callers 1

currentMethod · 0.80

Calls 1

enterMethod · 0.95

Tested by

no test coverage detected