/usr/local/lib64/python3.6/site-packages/torch/utils/benchmark/utils
NameSizeModeActions
valgrind_wrapper/-0755rm
__pycache__/-0755rm
common.py135960644editdlrm
compare.py123540644editdlrm
cpp_jit.py65970644editdlrm
fuzzer.py182110644editdlrm
sparse_fuzzer.py51650644editdlrm
timeit_template.cpp10170644editdlrm
timer.py192920644editdlrm
_stubs.py11420644editdlrm
__init__.py00644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/utils/benchmark/utils/timeit_template.cpp (1017B)
/* C++ template for Timer.timeit This template will be consumed by `cpp_jit.py`, and will replace: `GLOBAL_SETUP_TEMPLATE_LOCATION`, `SETUP_TEMPLATE_LOCATION` and `STMT_TEMPLATE_LOCATION` sections with user provided statements. */ #include #include #include #include #include // Global setup. (e.g. #includes) // GLOBAL_SETUP_TEMPLATE_LOCATION double timeit(int n) { pybind11::gil_scoped_release no_gil; // Setup // SETUP_TEMPLATE_LOCATION { // Warmup // STMT_TEMPLATE_LOCATION } // Main loop auto start_time = std::chrono::high_resolution_clock::now(); for(const auto loop_idx : c10::irange(n)) { // STMT_TEMPLATE_LOCATION } auto end_time = std::chrono::high_resolution_clock::now(); return std::chrono::duration(end_time - start_time).count(); } PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { m.def("timeit", &timeit); }