MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
ActivationLayers.cs
1using MyCaffe.param;
2using System;
3using System.Collections.Generic;
4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
7
9{
10 class ReluLayerInfo : LayerInfo
11 {
12 public ReluLayerInfo(LayerParameter layer, VariableCollection inputs) : base(layer, inputs)
13 {
14 }
15
16 public override string Generate(GENERATE gen)
17 {
18 string strCode = "";
19 if (gen == GENERATE.DEFINITION)
20 strCode += " self." + m_layer.name + " = nn.ReLU()" + Environment.NewLine;
21 else if (gen == GENERATE.INITWEIGHTS)
22 {
23 }
24 else if (gen == GENERATE.FORWARD)
25 strCode += " " + m_outputs.AsText + " = self." + m_layer.name + "(" + m_inputs.AsText + ")" + Environment.NewLine;
26
27 return strCode;
28 }
29 }
30
31 class ELULayerInfo : LayerInfo
32 {
33 public ELULayerInfo(LayerParameter layer, VariableCollection inputs) : base(layer, inputs)
34 {
35 }
36
37 public override string Generate(GENERATE gen)
38 {
39 string strCode = "";
40 if (gen == GENERATE.DEFINITION)
41 strCode += " self." + m_layer.name + " = nn.ELU()" + Environment.NewLine;
42 else if (gen == GENERATE.INITWEIGHTS)
43 {
44 }
45 else if (gen == GENERATE.FORWARD)
46 strCode += " " + m_outputs.AsText + " = self." + m_layer.name + "(" + m_inputs.AsText + ")" + Environment.NewLine;
47
48 return strCode;
49 }
50 }
51
52 class SigmoidLayerInfo : LayerInfo
53 {
54 public SigmoidLayerInfo(LayerParameter layer, VariableCollection inputs) : base(layer, inputs)
55 {
56 }
57
58 public override string Generate(GENERATE gen)
59 {
60 string strCode = "";
61 if (gen == GENERATE.DEFINITION)
62 strCode += " self." + m_layer.name + " = nn.Sigmoid()" + Environment.NewLine;
63 else if (gen == GENERATE.INITWEIGHTS)
64 {
65 }
66 else if (gen == GENERATE.FORWARD)
67 strCode += " " + m_outputs.AsText + " = self." + m_layer.name + "(" + m_inputs.AsText + ")" + Environment.NewLine;
68
69 return strCode;
70 }
71 }
72
73 class TanhLayerInfo : LayerInfo
74 {
75 public TanhLayerInfo(LayerParameter layer, VariableCollection inputs) : base(layer, inputs)
76 {
77 }
78
79 public override string Generate(GENERATE gen)
80 {
81 string strCode = "";
82 if (gen == GENERATE.DEFINITION)
83 strCode += " self." + m_layer.name + " = nn.Tanh()" + Environment.NewLine;
84 else if (gen == GENERATE.INITWEIGHTS)
85 {
86 }
87 else if (gen == GENERATE.FORWARD)
88 strCode += " " + m_outputs.AsText + " = self." + m_layer.name + "(" + m_inputs.AsText + ")" + Environment.NewLine;
89
90 return strCode;
91 }
92 }
93}
Specifies the base parameter for all layers.
The MyCaffe.param namespace contains parameters used to create models.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...
Definition: Annotation.cs:12