fork(1) download
  1. import numpy as np
  2.  
  3. a = np.array([
  4. [1, 2, 3],
  5. [4, 5, 6]
  6. ])
  7.  
  8. b = np.array([
  9. [7, 8],
  10. [9, 10],
  11. [11, 12]
  12. ])
  13.  
  14. c = np.tensordot(a, b, (1, 0))
  15. d = np.tensordot(a, b, 1)
  16.  
  17. print(c)
  18. print(c == d)
Success #stdin #stdout 0.18s 24808KB
stdin
Standard input is empty
stdout
[[ 58  64]
 [139 154]]
[[ True  True]
 [ True  True]]