区别

# -*- coding: utf-8 -*-
import numpy as np
a = np.array([[1,2],
             [3,4]])

b= np.arange(4).reshape((2,2))

c = a*b
c_dot = np.dot(a,b)
c_mul = np.multiply(a,b)

print('a:',a)
print('b:',b)

print(c)
print(c_dot)
print(c_mul)

 

 结果是

a: [[1 2]
 [3 4]]
b: [[0 1]
 [2 3]]
[[ 0  2]
 [ 6 12]]
[[ 4  7]
 [ 8 15]]
[[ 0  2]
 [ 6 12]]

 

相关文章:

  • 2022-01-07
  • 2021-12-15
  • 2021-11-30
  • 2021-10-29
  • 2021-11-14
猜你喜欢
  • 2022-01-07
  • 2021-12-06
  • 2023-02-15
  • 2022-01-27
  • 2021-04-25
相关资源
相似解决方案