Skip to content

Commit

Permalink
suppress unnecessarily duplicated code
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarx committed Dec 8, 2023
1 parent 690d1f3 commit a159820
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/keyframed/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ def linear(k, curve, *args, **kargs):
x0, x1 = left.t, right.t
y0, y1 = left.value, right.value

### <chatgpt>
# Handle both NumPy arrays and PyTorch tensors
if isinstance(y0, (np.ndarray, torch.Tensor)) and isinstance(y1, (np.ndarray, torch.Tensor)):
d = x1 - x0
t = (x1 - k) / d
if isinstance(y0, np.ndarray):
return t * y0 + (1 - t) * y1
else:
return t * y0 + (1 - t) * y1
### </chatgpt>
# ### <chatgpt>
# # Handle both NumPy arrays and PyTorch tensors
# if isinstance(y0, (np.ndarray, torch.Tensor)) and isinstance(y1, (np.ndarray, torch.Tensor)):
# d = x1 - x0
# t = (x1 - k) / d
# if isinstance(y0, np.ndarray):
# return t * y0 + (1 - t) * y1
# else:
# return t * y0 + (1 - t) * y1
# ### </chatgpt>

d = x1-x0
t = (x1-k)/d
Expand Down

0 comments on commit a159820

Please sign in to comment.