| 60 | //! |
| 61 | template <typename T> |
| 62 | float 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 |
no test coverage detected