Python: Extend for loop operation to each row in matrix without using iteration

后端 未结 0 888
忘掉有多难
忘掉有多难 2021-01-19 12:27

I have a piece of code like this:

a = Y[0]; b = Z[0]
print(a, b)
loss = 0
for i in range(len(a)):
    k = len(a)-i
    loss += (2**(k-1))*np.abs(a[i]-b[i])
pr         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题