17 #include "sample_as_op.h" 21 REGISTER_CPU_OPERATOR(SampleAs, SampleAsOp<float, CPUContext>);
22 REGISTER_CPU_OPERATOR(SampleAsGradient, SampleAsGradientOp<float, CPUContext>);
24 OPERATOR_SCHEMA(SampleAs)
28 Select the batch elements from input tensor X where the corresponding input 34 "Tensor of at least 1D shape (N, ...).")
38 "Tensor of type int with 1D shape (N, ).")
42 "Tensor with number of dims matching X, but with the length of dim 0 " 43 "equal to the number of non-zero elements in labels. The batch items " 44 "from X corresponding to the non-zero elements in labels are copied " 47 OPERATOR_SCHEMA(SampleAsGradient)
62 "Gradient of forward output 0 (Y).")
66 "Gradient of forward input 0 (X).");
69 using GradientMakerBase::GradientMakerBase;
70 vector<OperatorDef> GetGradientDefs()
override {
74 vector<string>{I(0), I(1), GO(0)},
75 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 ...