MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / findMedian

Function findMedian

samples/common/sampleReporting.cpp:62–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60//!
61template <typename T>
62float findMedian(std::vector<InferenceTime> const& timings, T const& toFloat)
63{
64 if (timings.empty())
65 {
66 return std::numeric_limits<float>::infinity();
67 }
68
69 int32_t const m = timings.size() / 2;
70 if (timings.size() % 2)
71 {
72 return toFloat(timings[m]);
73 }
74
75 return (toFloat(timings[m - 1]) + toFloat(timings[m])) / 2;
76}
77
78//!
79//! \brief Find coefficient of variance (which is std / mean) in a sorted sequence of timings given the mean

Callers 1

getPerformanceResultFunction · 0.85

Calls 3

toFloatFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected