MCPcopy Create free account
hub / github.com/BVLC/caffe / param_name_dict

Function param_name_dict

python/caffe/net_spec.py:28–40  ·  view source on GitHub ↗

Find out the correspondence between layer names and parameter names.

()

Source from the content-addressed store, hash-verified

26
27
28def param_name_dict():
29 """Find out the correspondence between layer names and parameter names."""
30
31 layer = caffe_pb2.LayerParameter()
32 # get all parameter names (typically underscore case) and corresponding
33 # type names (typically camel case), which contain the layer names
34 # (note that not all parameters correspond to layers, but we'll ignore that)
35 param_names = [f.name for f in layer.DESCRIPTOR.fields if f.name.endswith('_param')]
36 param_type_names = [type(getattr(layer, s)).__name__ for s in param_names]
37 # strip the final '_param' or 'Parameter'
38 param_names = [s[:-len('_param')] for s in param_names]
39 param_type_names = [s[:-len('Parameter')] for s in param_type_names]
40 return dict(zip(param_type_names, param_names))
41
42
43def to_proto(*tops):

Callers 1

net_spec.pyFile · 0.85

Calls 1

typeClass · 0.70

Tested by

no test coverage detected