File: histogram_op.cc

package info (click to toggle)
pytorch 1.13.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 139,252 kB
  • sloc: cpp: 1,100,274; python: 706,454; ansic: 83,052; asm: 7,618; java: 3,273; sh: 2,841; javascript: 612; makefile: 323; xml: 269; ruby: 185; yacc: 144; objc: 68; lex: 44
file content (30 lines) | stat: -rw-r--r-- 1,229 bytes parent folder | download | duplicates (2)
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
#include "caffe2/operators/histogram_op.h"

namespace caffe2 {

REGISTER_CPU_OPERATOR(Histogram, HistogramOp<CPUContext>);
OPERATOR_SCHEMA(Histogram)
    .NumInputs(1, INT_MAX)
    .NumOutputs(1)
    .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",
        "1D tensor of length k, wherein the i-th element expresses the count of tensor values "
        "that fall within range [bin_edges[i], bin_edges[i + 1])")
    .Arg(
        "bin_edges",
        "length-(k + 1) sequence of float values wherein the i-th element represents the inclusive "
        "left boundary of the i-th bin for i in [0, k - 1] and the exclusive right boundary "
        "of the (i-1)-th bin for i in [1, k].");

SHOULD_NOT_DO_GRADIENT(Histogram);
} // namespace caffe2