区别
# -*- 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]]