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

Method __exit__

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

Source from the content-addressed store, hash-verified

655 self._if_builder = parent._children[-1]
656
657 def __exit__(self, type, *args):
658 if type is None:
659 _else_nets = self._children
660 self._reset_children()
661
662 self._if_builder._else_net = NetBuilder.merge_nets(
663 _else_nets, self._lexical_scope)
664 if self._if_builder._else_net:
665 if_else_net = core.Net(self.name + '/if_else_net')
666 add_if_op(
667 if_else_net,
668 self._if_builder._cond_blob,
669 self._lexical_scope,
670 self._if_builder._then_net,
671 self._if_builder._else_net)
672 self._if_builder._current_net = if_else_net
673 self._if_builder._children = [if_else_net]
674 NetBuilder.__exit__(self, type, *args)
675
676
677class _RunWhileNet(NetBuilder):

Callers

nothing calls this directly

Calls 5

add_if_opFunction · 0.90
_reset_childrenMethod · 0.80
merge_netsMethod · 0.80
NetMethod · 0.80
__exit__Method · 0.45

Tested by

no test coverage detected