3using System.Collections.Generic;
6using System.Threading.Tasks;
10 class SoftmaxLossLayerInfo : SoftmaxLayerInfo
12 public SoftmaxLossLayerInfo(
LayerParameter layer, VariableCollection inputs) : base(layer, inputs)
14 m_rgstrReturnValues.Add(
"loss", 1);
17 public override string Generate(GENERATE gen)
21 if (gen == GENERATE.DEFINITION)
23 strCode +=
" self.smx = nn.Softmax(dim=" + m_layer.softmax_param.axis.ToString() +
")" + Environment.NewLine;
24 strCode +=
" self." + m_layer.name +
" = nn.CrossEntropyLoss()" + Environment.NewLine;
26 else if (gen == GENERATE.INITWEIGHTS)
29 else if (gen == GENERATE.FORWARD)
31 strCode +=
" smx1 = self.smx(" + m_inputs.AsText +
")" + Environment.NewLine;
32 strCode +=
" " + m_outputs.AsText +
" = self." + m_layer.name +
"(smx1, " + m_layer.bottom[1] +
")" + 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-...