1 #include "caffe2/operators/piecewise_linear_transform_op.h" 6 PiecewiseLinearTransform,
7 PiecewiseLinearTransformOp<float, CPUContext>);
9 OPERATOR_SCHEMA(PiecewiseLinearTransform)
13 PiecewiseLinearTransform takes inputs -- predictions, a 2-D or 1-D tensor 14 (Tensor) of size (batch_size x prediction_dimensions). The piecewise 15 linear functions are stored in bounds, slopes and intercepts. The output tensor 16 has the same shape of input `predictions` and contains the predictions 17 transformed by the piecewise linear functions. Each column of predictions has 18 its own piecewise linear transformation functions. Therefore the size of 19 piecewise function parameters are pieces x prediction_dimensions, except for 20 binary predictions where only the positive prediction needs them. Note that in 21 each piece, low bound is excluded while high bound is included. Also the 22 piecewise linear function must be continuous. 25 - If the input is binary predictions (Nx2 or Nx1 tensor), set the binary arg 26 to true so that one group of piecewise linear functions is needed (see 28 - The transform parameters (bounds, slopes, intercepts) can be passed either 29 through args or through input blobs. 30 - If we have multiple groups of piecewise linear functions, each group has the 31 same number of pieces. 32 - If a prediction is out of the bounds, it is capped to the smallest or largest 37 "1-D vector of size (prediction_dimensions x (pieces+1)) contain the " 38 "upper bounds of each piece of linear function. One special case is " 39 "the first bound is the lower bound of whole piecewise function and we " 40 "treat it the same as the left most functions. (bounds, slopes, " 41 "intercepts) can be passed through either arg or input blobs.")
44 "1-D vector of size (prediction_dimensions x pieces) containing the " 45 "slopes of linear function")
48 "1-D vector of size (prediction_dimensions x pieces) containing the " 49 "intercepts of linear function")
52 "If set true, we assume the input is a Nx1 or Nx2 tensor. If it is Nx1 " 53 "tensor, it is positive predictions. If the input is Nx2 tensor, its " 54 "first column is negative predictions and second column is positive " 55 "and negative + positive = 1. We just need one group of piecewise " 56 "linear functions for the positive predictions.")
60 "2-D tensor (Tensor) of size " 61 "(num_batches x num_classes) containing scores")
65 "See bounds in Arg. (bounds, slopes, intercepts) can be passed through " 66 "either arg or input blobs.")
70 "See slopes in Arg. (bounds, slopes, intercepts) can be passed through " 71 "either arg or input blobs.")
74 "intercepts (optional)",
75 "See intercepts in Arg. (bounds, slopes, intercepts) can be passed " 76 "through either arg or input blobs.")
80 "2-D tensor (Tensor) of size (num_batches x num_classes) " 81 "containing transformed predictions");
83 SHOULD_NOT_DO_GRADIENT(PiecewiseLinearTransform);
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...