diff --git a/predtuner/torchapp.py b/predtuner/torchapp.py index dac293f4201fa5bc5930a32f846937f7643ddc4e..f2bc4ee53ef255bcf45a90a20e6bef3a1fdad023 100644 --- a/predtuner/torchapp.py +++ b/predtuner/torchapp.py @@ -173,7 +173,7 @@ class TorchApp(ModeledApp, abc.ABC): """Measure the QoS and performance of Module with given approximation empirically (i.e., by running the Module on the dataset).""" - from time import time_ns + from time import time from tqdm import tqdm dataloader = self.test_loader if is_test else self.tune_loader @@ -182,13 +182,13 @@ class TorchApp(ModeledApp, abc.ABC): approxed = self._apply_knobs(with_approxes) qoses = [] - time_begin = time_ns() / (10 ** 9) + time_begin = time() for inputs, targets in dataloader: inputs = move_to_device_recursively(inputs, self.device) targets = move_to_device_recursively(targets, self.device) outputs = approxed(inputs) qoses.append(self.tensor_to_qos(outputs, targets)) - time_end = time_ns() / (10 ** 9) + time_end = time() qos = float(self.combine_qos(np.array(qoses))) return qos, time_end - time_begin