Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
volume to vector
def v2v(v, dims=None):
"""Convert volume to vector, or vector to volume"""
if v.ndim == 1:
assert dims != None
assert v.size == np.prod(dims)
return v.reshape(dims)
else:
return v.ravel()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.