17 #ifndef SOFTMAX_FOCAL_LOSS_OP_H_ 18 #define SOFTMAX_FOCAL_LOSS_OP_H_ 20 #include "caffe2/core/context.h" 21 #include "caffe2/core/logging.h" 22 #include "caffe2/core/operator.h" 23 #include "caffe2/utils/math.h" 27 template <
typename T,
class Context>
32 scale_(this->
template GetSingleArgument<float>(
"scale", 1.)),
33 gamma_(this->
template GetSingleArgument<float>(
"gamma", 1.)),
34 alpha_(this->
template GetSingleArgument<float>(
"alpha", 0.25)),
35 num_classes_(this->
template GetSingleArgument<int>(
"num_classes", 81)),
36 order_(StringToStorageOrder(
37 this->
template GetSingleArgument<string>(
"order",
"NCHW"))) {
38 CAFFE_ENFORCE(scale_ >= 0);
40 order_, StorageOrder::NCHW,
"Only NCHW order is supported right now.");
42 USE_OPERATOR_CONTEXT_FUNCTIONS;
44 bool RunOnDevice()
override {
46 CAFFE_NOT_IMPLEMENTED;
58 template <
typename T,
class Context>
63 scale_(this->
template GetSingleArgument<float>(
"scale", 1.)),
64 gamma_(this->
template GetSingleArgument<float>(
"gamma", 1.)),
65 alpha_(this->
template GetSingleArgument<float>(
"alpha", 0.25)),
66 num_classes_(this->
template GetSingleArgument<int>(
"num_classes", 81)),
67 order_(StringToStorageOrder(
68 this->
template GetSingleArgument<string>(
"order",
"NCHW"))) {
69 CAFFE_ENFORCE(scale_ >= 0);
71 order_, StorageOrder::NCHW,
"Only NCHW order is supported right now.");
73 USE_OPERATOR_CONTEXT_FUNCTIONS;
75 bool RunOnDevice()
override {
77 CAFFE_NOT_IMPLEMENTED;
91 #endif // SOFTMAX_FOCAL_LOSS_OP_H_
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...