Can't get mxnet function decorators
dmc1778 opened this issue · 2 comments
Description
I want to get mxnet function decorators in python. I can get the decorators for Tensorflow as follows:
Given that we have the following tensorflow API:
tf.math.floor(2.5)
When I run the code, the function arguments are set inside tensorflow object.
APIname = "tf.math.floor"
apit_split = APIname.split('.')
func_name = apit_split[-1]
module_obj = tf
if len(func_name_list) > 1:
for module_name in apit_split[:-1]:
module_obj = getattr(module_obj, module_name)
myfunction = getattr(module_obj, func_name)
And the output is:
As you can see, I have the decorators for the function. Now for mxnet, I have the following code snippet:
Given that we have the following mxnet API:
from mxnet import ndarray
x = ndarray.ones((2,3))
When I run the code, the function arguments are set inside ndarray object.
APIname = "ndarray.ones"
apit_split = APIname.split('.')
func_name = apit_split[-1]
module_obj = ndarray
if len(func_name_list) > 1:
for module_name in apit_split[:-1]:
module_obj = getattr(module_obj, module_name)
myfunction = getattr(module_obj, func_name)
The output is:
As you can see, there is no decorator for the function. Any idea? thanks.
References
https://fossies.org/linux/tensorflow/tensorflow/python/util/tf_decorator.py
Welcome to Apache MXNet (incubating)! We are on a mission to democratize AI, and we are glad that you are contributing to it by opening this issue.
Please make sure to include all the relevant context, and one of the @apache/mxnet-committers will be here shortly.
If you are interested in contributing to our project, let us know! Also, be sure to check out our guide on contributing to MXNet and our development guides wiki.
Just found the answer.
The problem is that I should do the above stuff inside __init__.py
located in the root folder of mxnet library (installed via pip).