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

Method AppendNet

caffe2/python/core.py:1544–1572  ·  view source on GitHub ↗
(self, net, device_option=None)

Source from the content-addressed store, hash-verified

1542
1543
1544 def AppendNet(self, net, device_option=None):
1545 assert isinstance(net, Net)
1546 for i in net.Proto().external_input:
1547 if (
1548 i not in self.Proto().external_input and
1549 i not in self._op_outputs
1550 ):
1551 self.Proto().external_input.append(i)
1552
1553 self.Proto().external_output.extend(
1554 [
1555 o for o in net.Proto().external_output
1556 if o not in self.Proto().external_output
1557 ]
1558 )
1559 ops = net.Proto().op
1560 if device_option is not None:
1561 ops = [copy.deepcopy(op) for op in ops]
1562 for op in ops:
1563 op.device_option.CopyFrom(device_option)
1564 for op in ops:
1565 if op.type == "RecurrentNetwork":
1566 for arg in op.arg:
1567 if arg.name.endswith('step_net'):
1568 for step_op in arg.n.op:
1569 step_op.device_option.CopyFrom(device_option)
1570
1571 self._ExtendOps(ops)
1572 return self
1573
1574 def LogInfo(self, *msg_or_blobs):
1575 for msg_or_blob in msg_or_blobs:

Callers 8

create_predict_init_netFunction · 0.95
_global_init_netFunction · 0.95
PyTorchModuleFunction · 0.80
GetCompleteNetMethod · 0.80
merge_netsMethod · 0.80
add_model_opsMethod · 0.80

Calls 5

ProtoMethod · 0.95
_ExtendOpsMethod · 0.95
isinstanceFunction · 0.85
appendMethod · 0.45
extendMethod · 0.45