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

Method current

caffe2/python/context.py:76–82  ·  view source on GitHub ↗
(cls, value=None, required=True)

Source from the content-addressed store, hash-verified

74
75 @classmethod
76 def current(cls, value=None, required=True):
77 ctx_info = _context_registry().get(cls)
78 if value is not None:
79 assert isinstance(value, cls), (
80 'Wrong context type. Expected: %s, got %s.' % (cls, type(value)))
81 return value
82 return ctx_info.get_active(required=required)
83
84 def __enter__(self):
85 for cls in _get_managed_classes(self):

Callers 15

build_pipelineFunction · 0.80
__init__Method · 0.80
report_stepMethod · 0.80
report_netMethod · 0.80
to_taskMethod · 0.80
final_outputFunction · 0.80
__init__Method · 0.80
current_prefixMethod · 0.80
create_paramMethod · 0.80
__init__Method · 0.80
netMethod · 0.80

Calls 4

_context_registryFunction · 0.85
isinstanceFunction · 0.85
get_activeMethod · 0.80
getMethod · 0.45

Tested by 9

build_pipelineFunction · 0.64
use_my_contextMethod · 0.64
testDecoratorMethod · 0.64
testNonDefaultCurrentMethod · 0.64
testDefaultCurrentMethod · 0.64
testNestedContextsMethod · 0.64
testChildClassesMethod · 0.64