apeforest commented on a change in pull request #11952: [MXNET-707] Add unit 
test for mxnet to coreml converter
URL: https://github.com/apache/incubator-mxnet/pull/11952#discussion_r213400631
 
 

 ##########
 File path: tools/coreml/unittest/test_converter_no_pred.py
 ##########
 @@ -0,0 +1,970 @@
+# 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 unittest
+import mxnet as mx
+import numpy as np
+
+from converter._mxnet_converter import convert
+from collections import namedtuple
+from converter import utils
+
+def _mxnet_remove_batch(input_data):
+    for blob in input_data:
+        input_data[blob] = np.reshape(input_data[blob], 
input_data[blob].shape[1:])
+    return input_data
+
+
+def _get_mxnet_module(net, data_shapes, mode, label_names, input_names=None):
+    """ Given a symbolic graph, input shape and the initialization mode,
+        returns an MXNet module.
+    """
+    mx.random.seed(1993)
+
+    mod = utils.create_module(sym=net, data_shapes=data_shapes, 
label_shapes=input_names, label_names=label_names)
+
+    if mode == 'random':
+        mod.init_params(
+            initializer=mx.init.Uniform(scale=.1)
+        )
+    elif mode == 'zeros':
+        mod.init_params(
+            initializer=mx.init.Zero()
+        )
+    elif mode == 'ones':
+        mod.init_params(
+            initializer=mx.init.One()
+        )
+    else:
+        Exception(KeyError("%s is not a valid initialization mode" % mode))
+
+    return mod
+
+
+class SingleLayerTest(unittest.TestCase):
+    """
+    Unit test class for testing where converter is able to convert individual 
layers or not.
 
 Review comment:
   Thanks. Corrected.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to