piiswrong commented on a change in pull request #7604: Refactor random linalg contrib namespaces URL: https://github.com/apache/incubator-mxnet/pull/7604#discussion_r135180510
########## File path: python/mxnet/base.py ########## @@ -359,3 +361,79 @@ def _as_list(obj): return obj else: return [obj] + + +_OP_NAME_PREFIX_LIST = ['_contrib_', '_linalg_', '_random_', '_sparse_'] + + +def _get_op_name_prefix(op_name): + """ + Check whether the given op_name starts with any words in `_OP_NAME_PREFIX_LIST`. + If found, return the prefix; else, return an empty string. + """ + for prefix in _OP_NAME_PREFIX_LIST: + if op_name.startswith(prefix): + return prefix + return "" + + +# pylint: enable=too-many-locals, invalid-name +def _init_op_module(root_namespace, module_name, make_op_func): Review comment: Let's put it in base for now ---------------------------------------------------------------- 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