3using System.Collections.Generic;
6using System.Threading.Tasks;
10 class LRNLayerInfo : LayerInfo
12 public LRNLayerInfo(
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.LocalResponseNorm(size=" + m_layer.lrn_param.local_size.ToString() +
", alpha=" + m_layer.lrn_param.alpha.ToString() +
", beta=" + m_layer.lrn_param.beta.ToString() +
", k=" + m_layer.lrn_param.k.ToString() +
")" + Environment.NewLine;
21 else if (gen == GENERATE.INITWEIGHTS)
25 strCode +=
" " + m_outputs.AsText +
" = self." + m_layer.name +
"(" + m_inputs.AsText +
")" + Environment.NewLine;
31 class BatchNormLayerInfo : LayerInfo
33 public BatchNormLayerInfo(
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.BatchNorm2d(num_features=" + m_inputs[0].getCount(1).ToString() +
", eps=" + m_layer.batch_norm_param.eps.ToString() +
")" + 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 LayerNormLayerInfo : LayerInfo
54 public LayerNormLayerInfo(
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.LayerNorm2d(num_features=" + m_inputs[0].getCount(2).ToString() +
", eps=" + m_layer.layer_norm_param.epsilon.ToString() +
")" + 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;
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-...