Closed
Description
Please describe the purpose of filing this issue
exp(x) * exp(y) => exp(x+y)
power(base, x) * power(base, y) => power(base, x + y)
From the top of my mind, I don't think such rewrite would affect numerical stability, but it should be faster...
import numpy as np
%timeit np.exp(9) * np.exp(2)
# 2.27 µs ± 53.5 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
%timeit np.exp(9+2)
# 1.11 µs ± 37 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
There was a PR for this in Theano that went stale: Theano/Theano#5272
Maybe we can borrow something from it.