bug fix for resize_with_interpolation in the case of length=0

This commit is contained in:
Grant Sanderson 2021-02-25 08:48:41 -08:00
parent 402c06c99a
commit 5636b41dfd

View file

@ -98,6 +98,8 @@ def resize_preserving_order(nparray, length):
def resize_with_interpolation(nparray, length):
if len(nparray) == length:
return nparray
if length == 0:
return np.zeros((0, *nparray.shape[1:]))
cont_indices = np.linspace(0, len(nparray) - 1, length)
return np.array([
(1 - a) * nparray[lh] + a * nparray[rh]