I have slow running python-3 script and upon profiling it, I have found the bottleneck to be the numpy array function. After reading up some documentation about it (https://numpy.org/neps/nep-0018-array-function-protocol.html), it seems that we can disable this functionality with an environment variable. So in my script, I do the following:
os.environ["NUMPY_EXPERIMENTAL_ARRAY_FUNCTION"]="0"
However, my profiling output (with cProfile) still shows calls for this array function:
ncalls tottime percall cumtime percall filename:lineno(function)
1321842/822748 1684.424 0.001 1938.861 0.002 {built-in method numpy.core._multiarray_umath.implement_array_function}
Am I missing something in terms of disabling this functionality? Do I need to use a different environment variable? My understanding is that if this functionality is disabled, no underlying calls to the array function would be made. Please let me know in case there is another workaround available to disable this numpy functionality.
I am using python 3.6.9 with numpy v 1.18.1.
Thank you.