\brief print the npu profile \param npu_time the npu time \param op the operation \param n_iter the number of iterations
| 214 | /// \param op the operation |
| 215 | /// \param n_iter the number of iterations |
| 216 | inline void print_npu_profile(time_utils::time_with_unit npu_time, float op, int n_iter = 1){ |
| 217 | npu_time.first /= n_iter; |
| 218 | time_utils::time_with_unit time_united = time_utils::re_unit(npu_time); |
| 219 | time_united = time_utils::cast_to_s(time_united); |
| 220 | |
| 221 | |
| 222 | float ops = op / (time_united.first); |
| 223 | float speed = ops / 1000000; |
| 224 | std::string ops_unit = "Mops"; |
| 225 | std::string speed_unit = "Mops/s"; |
| 226 | if (speed > 1000){ |
| 227 | speed /= 1000; |
| 228 | speed_unit = "Gops/s"; |
| 229 | } |
| 230 | if (speed > 1000000){ |
| 231 | speed /= 1000000; |
| 232 | speed_unit = "Tops/s"; |
| 233 | } |
| 234 | |
| 235 | time_united = time_utils::re_unit(npu_time); |
| 236 | MSG_BONDLINE(40); |
| 237 | MSG_BOX_LINE(40, "NPU time : " << time_united.first << " " << time_united.second); |
| 238 | MSG_BOX_LINE(40, "NPU speed: " << speed << " " << speed_unit); |
| 239 | MSG_BONDLINE(40); |
| 240 | } |
| 241 | |
| 242 | /// \brief compare the vectors |
| 243 | /// \param y the y |