-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtry.cpp
More file actions
35 lines (30 loc) · 958 Bytes
/
Copy pathtry.cpp
File metadata and controls
35 lines (30 loc) · 958 Bytes
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
31
32
33
34
35
//#define DEBUG
#include <iostream>
#include "out/code.cpp"
#include <chrono>
int main()
{
int batch=50;
set_values();
std::cout << "seted" << std::endl;
Tensor<float, 2> input(batch,16);
std::cout << "init" << std::endl;
input.setRandom();
std::cout << "rand" << std::endl;
int retry = 1000000;
std::cout << "starting" << std::endl;
auto start = std::chrono::high_resolution_clock::now();
for (int i = 0; i < retry; i++)
{
call_model<float, 2, 2>(input);
}
auto end = std::chrono::high_resolution_clock::now();
// Total elapsed time in seconds (double)
std::chrono::duration<double> elapsed = end - start;
// Average time per iteration in milliseconds
double avg_ms = (elapsed.count() * 1000.0) / (retry*batch);
std::cout << "Average time over " << retry
<< " runs: " << avg_ms << " ms" << std::endl;
std::cout << "done" << std::endl;
return 0;
}