且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

numpy / scipy中的平方差异(SSD)总和

更新时间:2022-12-09 22:02:58

只需

s = numpy.sum((A[:,:,0:3]-B[:,:,0:3])**2)

(我预计可能只是总和((AB)** 2)如果形状总是(,3))

(which I expect is likely just sum((A-B)**2) if the shape is always (,,3))

您还可以使用sum方法:((AB)** 2).sum ()

You can also use the sum method: ((A-B)**2).sum()

对吗?