MCPcopy Create free account
hub / github.com/davisking/dlib / layer

Class layer

tools/convert_dlib_nets_to_caffe/main.cpp:19–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17const std::set<string> comp_tags_with_params = {"fc", "fc_no_bias", "con", "affine_con", "affine_fc", "affine", "prelu"};
18
19struct layer
20{
21 string type; // comp, loss, or input
22 int idx;
23
24 matrix<long,4,1> output_tensor_shape; // (N,K,NR,NC)
25
26 string detail_name; // The name of the tag inside the layer tag. e.g. fc, con, max_pool, input_rgb_image.
27 std::map<string,double> attributes;
28 matrix<float> params;
29 long tag_id = -1; // If this isn't -1 then it means this layer was tagged, e.g. wrapped with tag2<> giving tag_id==2
30 long skip_id = -1; // If this isn't -1 then it means this layer draws its inputs from
31 // the most recent layer with tag_id==skip_id rather than its immediate predecessor.
32
33 double attribute (const string& key) const
34 {
35 auto i = attributes.find(key);
36 if (i != attributes.end())
37 return i->second;
38 else
39 throw dlib::error("Layer doesn't have the requested attribute '" + key + "'.");
40 }
41
42 string caffe_layer_name() const
43 {
44 if (type == "input")
45 return "data";
46 else
47 return detail_name+to_string(idx);
48 }
49};
50
51// ----------------------------------------------------------------------------------------
52

Calls

no outgoing calls

Tested by

no test coverage detected