MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / construct_init_net_from_params

Function construct_init_net_from_params

detectron2/export/shared.py:290–311  ·  view source on GitHub ↗

Construct the init_net from params dictionary

(
    params: Dict[str, Any], device_options: Optional[Dict[str, caffe2_pb2.DeviceOption]] = None
)

Source from the content-addressed store, hash-verified

288
289
290def 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
314def get_producer_map(ssa):

Callers 1

Calls 2

create_const_fill_opFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected