0
我有2個等效方程。一個用numpy.sqrt表示,另一個用(-1/2)的冪來表示。我得到兩個不同的答案。爲什麼?爲什麼numpy分數指數不起作用?
print 'var.shape', cache['var'].shape
print 'var: ', cache['var']
print 'eps: ', cache['eps']
print 'nonexponent', (1/np.sqrt(cache['var'] + cache['eps']))
print 'exponent: ', ((cache['var'] + cache['eps']) ** (-1/2))
結果
>> var.shape (5,)
>> var: [ 11.67073838 21.89655316 17.16595863 6.65632423 8.94247188]
>> eps: 1e-05
>> nonexponent [ 0.29271882 0.21370369 0.2413603 0.38759881 0.33440362]
>> exponent: [ 0.08568431 0.04566927 0.0582548 0.15023284 0.11182578]