17 #include "group_spatial_softmax_op.h" 18 #include "caffe2/operators/softmax_shared.h" 22 REGISTER_CPU_OPERATOR(
24 GroupSpatialSoftmaxOp<float, CPUContext>);
25 REGISTER_CPU_OPERATOR(
26 GroupSpatialSoftmaxGradient,
27 GroupSpatialSoftmaxGradientOp<float, CPUContext>);
29 OPERATOR_SCHEMA(GroupSpatialSoftmax)
33 RetinaNet specific form of spatial softmax. 35 The input is assumed to be unnormalized scores (sometimes called 'logits') 36 arranged in a 4D tensor with shape (N, C, H, W), where N is the number of 37 elements in the batch, H and W are the height and width, and C = num_anchors * 38 num_classes defines num_anchors 'groups' of softmax inputs, each of length 39 num_classes. The softmax is applied to each group independently. 41 See: https://arxiv.org/abs/1708.02002 for details. 45 "(int) default 81; number of classes in each softmax group.")
49 "4D tensor of softmax inputs (called 'scores' or 'logits') with shape " 50 "(N, C, H, W), where C = num_anchors * num_classes defines num_anchors " 51 "groups of contiguous num_classes softmax inputs.")
55 "4D tensor of softmax probabilities with shape (N, C, H, W), where " 56 "C = num_anchors * num_classes, and softmax was applied to each of the " 57 "num_anchors groups; within a group the num_classes values sum to 1.");
59 OPERATOR_SCHEMA(GroupSpatialSoftmaxGradient)
65 "See GroupSpatialSoftmax")
69 "Gradient of forward output 0 (probabilities).")
73 "Gradient of forward input 0 (scores).");
76 using GradientMakerBase::GradientMakerBase;
77 vector<OperatorDef> GetGradientDefs()
override {
79 "GroupSpatialSoftmaxGradient",
81 vector<string>{O(0), GO(0)},
82 vector<string>{GI(0)});
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
static vector< OperatorDef > SingleGradientDef(const Args &...args)
a helper function to allow one to create one single operator def, which is usually the case for many ...