larroy commented on a change in pull request #15118: Conversion from FP32 model 
to Mixed Precision model
URL: https://github.com/apache/incubator-mxnet/pull/15118#discussion_r295586564
 
 

 ##########
 File path: tests/python/gpu/test_contrib_amp.py
 ##########
 @@ -0,0 +1,255 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import os
+import sys
+import mxnet as mx
+import numpy as np
+import warnings
+import collections
+import ctypes
+import mxnet.contrib.amp as amp
+from nose.tools import assert_raises
+from mxnet.test_utils import set_default_context, download_model, 
compare_symbol_structure
+from mxnet.gluon.model_zoo.vision import get_model
+from mxnet.gluon import SymbolBlock
+from mxnet.contrib.amp import amp
+curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
+sys.path.insert(0, os.path.join(curr_path, '../unittest'))
+from common import with_seed, teardown
+
+def test_amp_coverage():
+    conditional = [item[0] for item in amp.lists.symbol.CONDITIONAL_FP32_FUNCS]
+
+    # Check for duplicates
+    for a in [amp.lists.symbol.FP16_FUNCS,
+          amp.lists.symbol.FP16_FP32_FUNCS,
+          amp.lists.symbol.FP32_FUNCS,
+          amp.lists.symbol.WIDEST_TYPE_CASTS,
+          conditional]:
+        ret = [item for item, count in collections.Counter(a).items() if count 
> 1]
+        assert ret == [], "Elements " + str(ret) + " are duplicated in the AMP 
lists."
+
+    t = []
+    for a in [amp.lists.symbol.FP16_FUNCS,
+              amp.lists.symbol.FP16_FP32_FUNCS,
+              amp.lists.symbol.FP32_FUNCS,
+              amp.lists.symbol.WIDEST_TYPE_CASTS,
+              conditional]:
+        t += a
+    ret = [item for item, count in collections.Counter(t).items() if count > 1]
+    assert ret == [], "Elements " + str(ret) + " exist in more than 1 AMP 
list."
+
+    # Check the coverage
+    py_str = lambda x: x.decode('utf-8')
+
+    plist = ctypes.POINTER(ctypes.c_char_p)()
+    size = ctypes.c_uint()
+
+    mx.base._LIB.MXListAllOpNames(ctypes.byref(size),
 
 Review comment:
   I think we should, as we are using the same for operator benchmarks done by 
@sandeep-krishnamurthy 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to