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_r244646560
##########
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:
Yes just replace the sys exit with a throw. This way if a service is
calling the script and for whatever reason the exception gets triggered the
service will have a chance to log the reason it's shutting down.
----------------------------------------------------------------
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