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

Method __exit__

caffe2/python/net_builder.py:729–743  ·  view source on GitHub ↗
(self, type, *args)

Source from the content-addressed store, hash-verified

727 self._cond_net = None
728
729 def __exit__(self, type, *args):
730 if type is None:
731 condition_body = self._children
732 self._reset_children()
733 self._cond_net = NetBuilder.merge_nets(
734 condition_body, self._lexical_scope)
735 assert self._cond_net, 'Invalid loop condition specified'
736 assert len(self._cond_net.Proto().op) > 0, 'Invalid condition net'
737 last_op = self._cond_net.Proto().op[-1]
738 assert len(last_op.output) == 1, 'Invalid condition net'
739 self._cond_blob = core.BlobReference(name=last_op.output[0], net=None)
740
741 self._current_net = self._cond_net
742 self._children = [self._cond_net]
743 NetBuilder.__exit__(self, type, *args)

Callers

nothing calls this directly

Calls 4

_reset_childrenMethod · 0.80
merge_netsMethod · 0.80
ProtoMethod · 0.45
__exit__Method · 0.45

Tested by

no test coverage detected