Skip to content

Instantly share code, notes, and snippets.

@freedomtowin
Created June 6, 2018 00:54
Show Gist options
  • Save freedomtowin/31c32f71a1958bbedefdbbac1f8e0878 to your computer and use it in GitHub Desktop.
Save freedomtowin/31c32f71a1958bbedefdbbac1f8e0878 to your computer and use it in GitHub Desktop.
def reshape_vector(w):
reshape_w = []
indx = 0
for shape,num in zip([30, 30, 1], [300, 300, 30]):
x = w[indx:num+indx]
if x.size!=num:
continue
x = x.reshape(shape,int(num/shape))
reshape_w.append(x)
indx = indx+num
extra_w = w[indx:]
return reshape_w,extra_w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment