Skip to content

Commit 8e32b7b

Browse files
authored
Merge pull request #453 from NVIDIA/pybind_fix
Fix pybind empty buffer issue
2 parents a509bda + c7014a8 commit 8e32b7b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

py/trtorch/ptq.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,16 @@ def read_calibration_cache(self):
4242
if os.path.exists(self.cache_file):
4343
with open(self.cache_file, "rb") as f:
4444
return f.read()
45+
else:
46+
return b""
4547

4648

4749
def write_calibration_cache(self, cache):
4850
if self.cache_file:
4951
with open(self.cache_file, "wb") as f:
5052
f.write(cache)
53+
else:
54+
return b""
5155

5256

5357
class DataLoaderCalibrator(object):

0 commit comments

Comments
 (0)