File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed
core/conversion/conversionctx Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,9 @@ std::string ConversionCtx::SerializeEngine() {
148
148
auto engine = builder->buildEngineWithConfig (*net, *cfg);
149
149
auto serialized_engine = engine->serialize ();
150
150
engine->destroy ();
151
- return std::string ((const char *)serialized_engine->data (), serialized_engine->size ());
151
+ auto engine_str = std::string ((const char *)serialized_engine->data (), serialized_engine->size ());
152
+ serialized_engine->destroy ();
153
+ return engine_str;
152
154
}
153
155
154
156
bool ConversionCtx::CheckLayerAddition (const torch::jit::Node* n) {
Original file line number Diff line number Diff line change @@ -157,5 +157,6 @@ def get_build_info() -> str:
157
157
build_info = "TRTorch Version: " + str (__version__ ) + '\n ' + build_info
158
158
return build_info
159
159
160
+
160
161
def set_device (gpu_id ):
161
162
trtorch ._C .set_device (gpu_id )
Original file line number Diff line number Diff line change 5
5
6
6
from model_test_case import ModelTestCase
7
7
8
+
8
9
class TestMultiGpuSwitching (ModelTestCase ):
10
+
9
11
def setUp (self ):
10
12
if torch .cuda .device_count () < 2 :
11
13
self .fail ("Test is not relevant for this platform since number of available CUDA devices is less than 2" )
@@ -55,12 +57,14 @@ def test_compile_script(self):
55
57
trtorch .set_device (0 )
56
58
self .assertTrue (same < 2e-3 )
57
59
60
+
58
61
def test_suite ():
59
62
suite = unittest .TestSuite ()
60
63
suite .addTest (TestMultiGpuSwitching .parametrize (TestMultiGpuSwitching , model = models .resnet18 (pretrained = True )))
61
64
62
65
return suite
63
66
67
+
64
68
suite = test_suite ()
65
69
66
70
runner = unittest .TextTestRunner ()
You can’t perform that action at this time.
0 commit comments