ZhennanQin commented on a change in pull request #13697: [MKLDNN] Enable signed 
int8 support for convolution.
URL: https://github.com/apache/incubator-mxnet/pull/13697#discussion_r244667743
 
 

 ##########
 File path: python/mxnet/contrib/quantization.py
 ##########
 @@ -139,18 +136,20 @@ def __init__(self, include_layer=None, logger=None):
 
     def collect(self, name, arr):
         """Callback function for collecting layer output NDArrays."""
-        name = py_str(name)
-        if self.include_layer is not None and not self.include_layer(name):
-            return
-        handle = ctypes.cast(arr, NDArrayHandle)
-        arr = NDArray(handle, writable=False).copyto(cpu())
-        if self.logger is not None:
-            self.logger.info("Collecting layer %s output of shape %s" % (name, 
arr.shape))
-        if name in self.nd_dict:
-            self.nd_dict[name].append(arr)
-        else:
-            self.nd_dict[name] = [arr]
-
+        try:
+            name = py_str(name)
+            if self.include_layer is not None and not self.include_layer(name):
+                return
+            handle = ctypes.cast(arr, NDArrayHandle)
+            arr = NDArray(handle, writable=False).copyto(cpu())
+            if self.logger is not None:
+                self.logger.info("Collecting layer %s output of shape %s" % 
(name, arr.shape))
+            if name in self.nd_dict:
+                self.nd_dict[name].append(arr)
+            else:
+                self.nd_dict[name] = [arr]
+        except KeyboardInterrupt:
 
 Review comment:
   As it's just an improvement for user friendly, not necessary for this PR. So 
I removed this out of PR. We can add this back when we get good solution.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to