bgawrych commented on code in PR #20983:
URL: https://github.com/apache/incubator-mxnet/pull/20983#discussion_r845795177


##########
python/mxnet/amp/__init__.py:
##########
@@ -20,3 +20,33 @@
 """Automatic mixed precision module."""
 
 from .amp import *
+
+import ctypes
+from ..base import (_LIB, check_call)
+
+
+def set_is_amp_disabled(value):
+    prev = ctypes.c_int()
+    check_call(_LIB.MXSetIsAMPDisabled(ctypes.c_int(value), 
ctypes.byref(prev)))
+    return bool(prev.value)
+
+
+def is_amp_disabled():
+    curr = ctypes.c_int()
+    check_call(_LIB.MXIsAMPDisabled(ctypes.byref(curr)))
+    return bool(curr.value)
+
+
+def disable_amp():
+    return _DisableAMPScope()
+
+
+class _DisableAMPScope(object):
+    def __init__(self):  # pylint: disable=redefined-outer-name

Review Comment:
   Is this pylint exception necessary?



##########
include/mxnet/c_api.h:
##########
@@ -1225,6 +1225,18 @@ MXNET_DLL int MXAutogradIsRecording(bool* curr);
  * \return 0 when success, -1 when failure happens
  */
 MXNET_DLL int MXAutogradIsTraining(bool* curr);
+/*!
+ * \brief set whether to disable AMP
+ * \param curr returns the current status

Review Comment:
   ```suggestion
    * \param prev returns the current status
   ```



##########
src/c_api/c_api_ndarray.cc:
##########
@@ -291,6 +291,18 @@ int MXAutogradSetIsRecording(int is_recording, int* prev) {
   API_END();
 }
 
+int MXSetIsAMPDisabled(int is_amp_disabled, int* prev) {

Review Comment:
   why is_amp_disabled can't be just bool?



##########
include/mxnet/c_api.h:
##########
@@ -1225,6 +1225,18 @@ MXNET_DLL int MXAutogradIsRecording(bool* curr);
  * \return 0 when success, -1 when failure happens
  */
 MXNET_DLL int MXAutogradIsTraining(bool* curr);
+/*!
+ * \brief set whether to disable AMP
+ * \param curr returns the current status

Review Comment:
   lack of is_amp_disabled in doc



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to