From d66d2c43274b44b1e3bab6b67a7d643f85969e2b Mon Sep 17 00:00:00 2001
From: Yifan Zhao <yifanz16@illinois.edu>
Date: Fri, 22 Jan 2021 20:56:24 -0600
Subject: [PATCH] Added repr for torchapp

---
 predtuner/torchapp.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/predtuner/torchapp.py b/predtuner/torchapp.py
index b30968b..6bc700b 100644
--- a/predtuner/torchapp.py
+++ b/predtuner/torchapp.py
@@ -124,6 +124,14 @@ class TorchApp(ModeledApp, abc.ABC):
         qos = self.combine_qos(np.array(qoses))
         return 0.0, qos
 
+    def __repr__(self) -> str:
+        class_name = self.__class__.__name__
+        module_class_name = type(self.module).__name__
+        return (
+            f'{class_name}"{self.name}"(module={module_class_name}, '
+            f"num_op={len(self._op_knobs)}, num_knob={len(self.name_to_knob)})"
+        )
+
     @torch.no_grad()
     def _get_raw_output_valset(self, with_approxes: KnobsT):
         approxed = self._apply_knobs(with_approxes)
-- 
GitLab