What are the similarities and differences between numpy.divide and the Python slash / operator? As far as I can tell they behave the same, both implementing an element-wise division. The Numpy documentation mentions:
numpy.divide(x1, x2) ... Equivalent to x1 / x2 in terms of array-broadcasting. ...
Implying that np.divide(x1, x2) is not completely equivalent to x1 / x2. I have run the following snippet to compare their speed:
import numpy as np
import time
a = np.random.rand(10000, 10000)
b = np.random.rand(10000, 10000)
tic = time.time()
c = a / b
toc = time.time()
print("Python divide took: ", toc - tic)
tic = time.time()
c = np.divide(a, b)
toc = time.time()
print("Numpy divide took: ", toc - tic)
It appears that the Python divide generally runs faster which leads me to believe the Numpy divide implements some additional bells and whistles.
Any help is much appreciated!