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

Method __exit__

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

Source from the content-addressed store, hash-verified

624 return NetBuilder.add(self, child)
625
626 def __exit__(self, type, *args):
627 if type is None:
628 _then_nets = self._children
629 self._reset_children()
630
631 self._then_net = NetBuilder.merge_nets(
632 _then_nets, self._lexical_scope)
633 if not self._then_net:
634 self._then_net = core.Net('empty_then_net')
635
636 if_net = core.Net(self.name + '/if_net')
637 add_if_op(if_net, self._cond_blob, self._lexical_scope,
638 self._then_net, self._else_net)
639
640 self._current_net = if_net
641 self._children = [if_net]
642 NetBuilder.__exit__(self, type, *args)
643
644
645class _RunElseNet(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