code: def set_monitor_callback(self, callback, monitor_all=False):
          
          cb_type = ctypes.CFUNCTYPE(None, ctypes.c_char_p, NDArrayHandle, ctypes.c_void_p)
          self._monitor_callback = cb_type(_monitor_callback_wrapper(callback))
          check_call(_LIB.MXExecutorSetMonitorCallbackEX(
              self.handle,
              self._monitor_callback,
              None,
              ctypes.c_int(monitor_all)))
docs: Install callback for monitor.
  
          Parameters
          ----------
          callback : function
              Takes a string and an NDArrayHandle.
          monitor_all : bool, default False
              If true, monitor both input and output, otherwise monitor output only.
  
          Examples
          --------
          >>> def mon_callback(*args, **kwargs):
          >>>     print("Do your stuff here.")
          >>>
          >>> texe.set_monitor_callback(mon_callback)