0

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:

enter image description here

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:

enter image description here

As you can see, there is no decorator for the function. Any idea? thanks.

Nima shiri
  • 73
  • 7

1 Answers1

0

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).

Nima shiri
  • 73
  • 7