Construct the init_net from params dictionary
(
params: Dict[str, Any], device_options: Optional[Dict[str, caffe2_pb2.DeviceOption]] = None
)
| 288 | |
| 289 | |
| 290 | def construct_init_net_from_params( |
| 291 | params: Dict[str, Any], device_options: Optional[Dict[str, caffe2_pb2.DeviceOption]] = None |
| 292 | ) -> caffe2_pb2.NetDef: |
| 293 | """ |
| 294 | Construct the init_net from params dictionary |
| 295 | """ |
| 296 | init_net = caffe2_pb2.NetDef() |
| 297 | device_options = device_options or {} |
| 298 | for name, blob in params.items(): |
| 299 | if isinstance(blob, str): |
| 300 | logger.warning( |
| 301 | ( |
| 302 | "Blob {} with type {} is not supported in generating init net," |
| 303 | " skipped.".format(name, type(blob)) |
| 304 | ) |
| 305 | ) |
| 306 | continue |
| 307 | init_net.op.extend( |
| 308 | [create_const_fill_op(name, blob, device_option=device_options.get(name, None))] |
| 309 | ) |
| 310 | init_net.external_output.append(name) |
| 311 | return init_net |
| 312 | |
| 313 | |
| 314 | def get_producer_map(ssa): |
no test coverage detected