squeeze extra dims for numpy vectors
parent
e37ce8eccb
commit
6297b55f28
|
@ -6,9 +6,9 @@ def Vector(*args):
|
||||||
Convenient function to create numpy vector to use with gtsam cython wrapper
|
Convenient function to create numpy vector to use with gtsam cython wrapper
|
||||||
Usage: Vector(1), Vector(1,2,3), Vector(3,2,4)
|
Usage: Vector(1), Vector(1,2,3), Vector(3,2,4)
|
||||||
"""
|
"""
|
||||||
ret = np.asarray(args, dtype='float')
|
ret = np.squeeze(np.asarray(args, dtype='float'))
|
||||||
while ret.ndim >= 2:
|
if ret.ndim == 0:
|
||||||
ret = ret[0, :]
|
ret = np.expand_dims(ret, axis=0)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue