File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ int main(int argc, const char* argv[]) {
38
38
}
39
39
40
40
mod.to (at::kCUDA );
41
+ mod.eval ();
41
42
42
43
std::vector<std::vector<int64_t >> dims;
43
44
for (int i = 2 ; i < argc; i++) {
@@ -92,7 +93,7 @@ int main(int argc, const char* argv[]) {
92
93
std::cout << " Running TRT module" << std::endl;
93
94
torch::jit::IValue trt_results_ivalues = trt_mod.forward (trt_inputs_ivalues);
94
95
std::vector<at::Tensor> trt_results;
95
- if (trt_results_ivalues.isTensor ()) {
96
+ if (trt_results_ivalues.isTensor ()) {
96
97
trt_results.push_back (trt_results_ivalues.toTensor ());
97
98
} else {
98
99
auto results = trt_results_ivalues.toTuple ()->elements ();
@@ -106,5 +107,8 @@ int main(int argc, const char* argv[]) {
106
107
}
107
108
108
109
std::cout << " Converted Engine saved to /tmp/engine_converted_from_jit.trt" << std::endl;
110
+
111
+ trt_mod.save (" /tmp/ts_trt.ts" );
112
+ std::cout << " Compiled TorchScript program saved to /tmp/ts_trt.ts" << std::endl;
109
113
std::cout << " ok\n " ;
110
114
}
You can’t perform that action at this time.
0 commit comments