MCPcopy Index your code
hub / github.com/tensorflow/tensorboard / _MakeHistogram

Function _MakeHistogram

tensorboard/scripts/generate_testdata.py:62–84  ·  view source on GitHub ↗

Convert values into a histogram proto using logic from histogram.cc.

(values)

Source from the content-addressed store, hash-verified

60
61
62def _MakeHistogram(values):
63 """Convert values into a histogram proto using logic from histogram.cc."""
64 limits = _MakeHistogramBuckets()
65 counts = [0] * len(limits)
66 for v in values:
67 idx = bisect.bisect_left(limits, v)
68 counts[idx] += 1
69
70 limit_counts = [
71 (limits[i], counts[i]) for i in range(len(limits)) if counts[i]
72 ]
73 bucket_limit = [lc[0] for lc in limit_counts]
74 bucket = [lc[1] for lc in limit_counts]
75 sum_sq = sum(v * v for v in values)
76 return tf.compat.v1.HistogramProto(
77 min=min(values),
78 max=max(values),
79 num=len(values),
80 sum=sum(values),
81 sum_squares=sum_sq,
82 bucket_limit=bucket_limit,
83 bucket=bucket,
84 )
85
86
87def WriteScalarSeries(writer, tag, f, n=5):

Callers 1

WriteHistogramSeriesFunction · 0.85

Calls 3

_MakeHistogramBucketsFunction · 0.85
rangeFunction · 0.85
sumFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…