1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#include "caffe2/operators/self_binning_histogram_op.h"
namespace caffe2 {
REGISTER_CPU_OPERATOR(SelfBinningHistogram, SelfBinningHistogramOp<CPUContext>);
OPERATOR_SCHEMA(SelfBinningHistogram)
.NumInputs(1, INT_MAX)
.NumOutputs(2)
.SetDoc(
R"DOC(
Computes a histogram for values in the given list of tensors.
For logging activation histograms for post-hoc analyses, consider using the
HistogramObserver observer.
For iteratively computing a histogram for all input tensors encountered through
history, consider using the AccumulateHistogram operator.
)DOC")
.Input(0, "X1, X2, ...", "*(type: Tensor`<float>`)* List of input tensors.")
.Output(
0,
"histogram_values",
"1D tensor of edges of the bins, of dimension [num_bins+1]."
" The range appears as: [first, ..., last), wherein the i-th element"
" expresses the start of a bin and i+1-th value represents the exclusive"
" end of that bin.")
.Output(
1,
"histogram_counts",
"1D tensor of counts of each bin, of dimension [num_bins+1]."
" It is guaranteed to end with a 0 since the last edge is exclusive.")
.Arg("num_bins", "Number of bins to use for the histogram. Must be >= 1.")
.Arg(
"bin_spacing",
"A string indicating 'linear' or 'logarithmic' spacing for the bins.")
.Arg(
"logspace_start",
"A float that's used as the starting point for logarithmic spacing. "
"Since logarithmic spacing cannot contain <=0 values this value will "
"be used to represent all such values.")
.Arg(
"abs",
"Apply abs() on every input value."
);
SHOULD_NOT_DO_GRADIENT(SelfBinningHistogram);
} // namespace caffe2
|