@@ -64,13 +64,13 @@ import os
64
64
from setuptools import setup, Extension
65
65
from torch.utils import cpp_extension
66
66
67
- dir_path = os.path.dirname(os.path.realpath(__file__))
68
67
69
68
# library_dirs should point to the libtrtorch.so, include_dirs should point to the dir that include the headers
70
69
# 1) download the latest package from https://github.com/NVIDIA/TRTorch/releases/
71
70
# 2) Extract the file from downloaded package, we will get the "trtorch" directory
72
71
# 3) Set trtorch_path to that directory
73
- trtorch_path = os.path.abspath("trtorch")
72
+ trtorch_path = <PATH TO TRTORCH>
73
+
74
74
75
75
ext_modules = [
76
76
cpp_extension.CUDAExtension('elu_converter', ['./csrc/elu_converter.cpp'],
@@ -120,7 +120,7 @@ class Elu(torch.nn.Module):
120
120
return self .elu(x)
121
121
122
122
123
- def MaxDiff (pytorch_out , trtorch_out ):
123
+ def cal_max_diff (pytorch_out , trtorch_out ):
124
124
diff = torch.sub(pytorch_out, trtorch_out)
125
125
abs_diff = torch.abs(diff)
126
126
max_diff = torch.max(abs_diff)
@@ -148,7 +148,7 @@ def main():
148
148
trtorch_out = trt_ts_module(input_data)
149
149
print (' PyTorch output: \n ' , pytorch_out[0 , :, :, 0 ])
150
150
print (' TRTorch output: \n ' , trtorch_out[0 , :, :, 0 ])
151
- MaxDiff (pytorch_out, trtorch_out)
151
+ cal_max_diff (pytorch_out, trtorch_out)
152
152
153
153
154
154
if __name__ == " __main__" :
0 commit comments