KellenSunderland 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_r244622070
 
 

 ##########
 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:
   We should probably never explicitly cause the process to exit in a library 
like MXNet.  This could make it tricky to debug issues for applications that 
consume MXNet.  If you consume a library you don't want that library killing 
your process before you have a change to handle an error or log a failure.

----------------------------------------------------------------
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