forked from OpenNMT/CTranslate2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecution_stats.cc
More file actions
29 lines (23 loc) · 1.04 KB
/
Copy pathexecution_stats.cc
File metadata and controls
29 lines (23 loc) · 1.04 KB
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
#include "module.h"
#include <ctranslate2/translator.h>
namespace ctranslate2 {
namespace python {
void register_translation_stats(py::module& m) {
py::class_<ExecutionStats>(m, "ExecutionStats",
"A structure containing some execution statistics.")
.def_readonly("num_tokens", &ExecutionStats::num_tokens,
"Number of output tokens.")
.def_readonly("num_examples", &ExecutionStats::num_examples,
"Number of processed examples.")
.def_readonly("total_time_in_ms", &ExecutionStats::total_time_in_ms,
"Total processing time in milliseconds.")
.def("__repr__", [](const ExecutionStats& stats) {
return "ExecutionStats(num_tokens=" + std::string(py::repr(py::cast(stats.num_tokens)))
+ ", num_examples=" + std::string(py::repr(py::cast(stats.num_examples)))
+ ", total_time_in_ms=" + std::string(py::repr(py::cast(stats.total_time_in_ms)))
+ ")";
})
;
}
}
}