Skip to content

Commit

Permalink
Explicitly set step in range
Browse files Browse the repository at this point in the history
  • Loading branch information
pnezis committed Dec 11, 2024
1 parent a004499 commit e7f9ce2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/tucan/image.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ defmodule Tucan.Image do
:lower -> {height - 1, 0}
end

step = if start_index <= end_index, do: 1, else: -1

y =
Nx.tensor(Enum.to_list(start_index..end_index))
Nx.tensor(Enum.to_list(start_index..end_index//step))
|> Nx.broadcast({height, width}, axes: [0])
|> Nx.to_flat_list()

Expand Down

0 comments on commit e7f9ce2

Please sign in to comment.