aboutsummaryrefslogtreecommitdiff
path: root/gantools/latent_space.py
diff options
context:
space:
mode:
Diffstat (limited to 'gantools/latent_space.py')
-rw-r--r--gantools/latent_space.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/gantools/latent_space.py b/gantools/latent_space.py
index 44c64a3..64e3dec 100644
--- a/gantools/latent_space.py
+++ b/gantools/latent_space.py
@@ -21,8 +21,11 @@ def cubic_spline_interp(points, step_count):
tck = interpolate.splrep(x, y, s=0)
xnew = np.linspace(0., 1., step_count)
return interpolate.splev(xnew, tck, der=0)
+ if points.shape[0] < 4:
+ raise ValueError('Too few points for cubic interpolation: need 4, got {}'.format(points.shape[0]))
return np.apply_along_axis(cubic_spline_interp1d, 0, points)
+
# TODO: the math in this function is embarrasingly bad. fix at some point.
def sequence_keyframes(keyframes, num_frames, batch_size=1, interp_method='linear', loop=False):
interp_fn = {