Numpy - np.inner


# Multi-dimensional array example  import numpy as np a = np.array([[1,2], [3,4]]) print 'Array a:' print a b = np.array([[11, 12], [13, 14]]) print 'Array b:' print b print 'Inner product:' print np.inner(a,b)

It will produce the following output −

Array a:
[[1 2]
[3 4]]

Array b:
[[11 12]
[13 14]]

Inner product:
[[35 41]
[81 95]]

In the above case, the inner product is calculated as −

1*11+2*12, 1*13+2*14 
3*11+4*12, 3*13+4*14
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM