Skip to content

Commit c7014a8

Browse files
committed
Fix pybind empty buffer issue
Signed-off-by: Dheeraj Peri <[email protected]>
1 parent a509bda commit c7014a8

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)