image1734×1172 152 KB

Is there an efficient way to do the above operation without using the for loop?
One way:
h = 4
w = 4
c = 2
A = given_tensor.reshape(h,w,c,4)
B = zeros(128,4)
Then
count = 0
for i in range(h):
for j in range(w):
for k in range(c):
B[count,:] =  A[i,h,k,:]
count = count + 1