r""" construct init net and train net from complete_net Inputs: net: 'core.Net' containing param_init_net and train net
(self, net)
| 465 | return new_net |
| 466 | |
| 467 | def ConstructInitTrainNetfromNet(self, net): |
| 468 | r""" construct init net and train net from complete_net |
| 469 | Inputs: |
| 470 | net: 'core.Net' containing param_init_net and train net |
| 471 | """ |
| 472 | param_op_mask = [] |
| 473 | train_op_mask = [] |
| 474 | for idx, op in enumerate(net.Proto().op): |
| 475 | if op.debug_info.endswith("/param_init_net"): |
| 476 | param_op_mask.append(idx) |
| 477 | else: |
| 478 | train_op_mask.append(idx) |
| 479 | |
| 480 | self.param_init_net = net.Clone( |
| 481 | net.Name() + "/generated_param_init_net", |
| 482 | keep_schema=True, |
| 483 | op_id_mask=param_op_mask, |
| 484 | update_external_list=True, |
| 485 | ) |
| 486 | self.net = net.Clone( |
| 487 | net.Name() + "/generated_net", |
| 488 | keep_schema=True, |
| 489 | op_id_mask=train_op_mask, |
| 490 | update_external_list=True, |
| 491 | ) |
| 492 | |
| 493 | |
| 494 | def ExtractPredictorNet( |