3using System.Collections.Generic;
6using System.Threading.Tasks;
10 class ReluLayerInfo : LayerInfo
12 public ReluLayerInfo(
LayerParameter layer, VariableCollection inputs) : base(layer, inputs)
16 public override string Generate(GENERATE gen)
19 if (gen == GENERATE.DEFINITION)
20 strCode +=
" self." + m_layer.name +
" = nn.ReLU()" + Environment.NewLine;
21 else if (gen == GENERATE.INITWEIGHTS)
24 else if (gen == GENERATE.FORWARD)
25 strCode +=
" " + m_outputs.AsText +
" = self." + m_layer.name +
"(" + m_inputs.AsText +
")" + Environment.NewLine;
31 class ELULayerInfo : LayerInfo
33 public ELULayerInfo(
LayerParameter layer, VariableCollection inputs) : base(layer, inputs)
37 public override string Generate(GENERATE gen)
40 if (gen == GENERATE.DEFINITION)
41 strCode +=
" self." + m_layer.name +
" = nn.ELU()" + Environment.NewLine;
42 else if (gen == GENERATE.INITWEIGHTS)
45 else if (gen == GENERATE.FORWARD)
46 strCode +=
" " + m_outputs.AsText +
" = self." + m_layer.name +
"(" + m_inputs.AsText +
")" + Environment.NewLine;
52 class SigmoidLayerInfo : LayerInfo
54 public SigmoidLayerInfo(
LayerParameter layer, VariableCollection inputs) : base(layer, inputs)
58 public override string Generate(GENERATE gen)
61 if (gen == GENERATE.DEFINITION)
62 strCode +=
" self." + m_layer.name +
" = nn.Sigmoid()" + Environment.NewLine;
63 else if (gen == GENERATE.INITWEIGHTS)
66 else if (gen == GENERATE.FORWARD)
67 strCode +=
" " + m_outputs.AsText +
" = self." + m_layer.name +
"(" + m_inputs.AsText +
")" + Environment.NewLine;
73 class TanhLayerInfo : LayerInfo
75 public TanhLayerInfo(
LayerParameter layer, VariableCollection inputs) : base(layer, inputs)
79 public override string Generate(GENERATE gen)
82 if (gen == GENERATE.DEFINITION)
83 strCode +=
" self." + m_layer.name +
" = nn.Tanh()" + Environment.NewLine;
84 else if (gen == GENERATE.INITWEIGHTS)
87 else if (gen == GENERATE.FORWARD)
88 strCode +=
" " + m_outputs.AsText +
" = self." + m_layer.name +
"(" + m_inputs.AsText +
")" + Environment.NewLine;
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-...