Skip to content

Commit ff04aca

Browse files
committed
Remove Elixir v1.15 related TODOs
1 parent c7cdd84 commit ff04aca

File tree

2 files changed

+4
-34
lines changed

2 files changed

+4
-34
lines changed

nx/lib/nx/defn/expr.ex

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ defmodule Nx.Defn.Expr do
612612
{nil, range}
613613

614614
unroll when is_integer(unroll) and unroll > 0 ->
615-
{internal, external} = split_range(range, size - rem(size, unroll))
615+
{internal, external} = Range.split(range, size - rem(size, unroll))
616616
{{internal, 0..(unroll - 1)//1}, external}
617617

618618
unroll ->
@@ -730,33 +730,6 @@ defmodule Nx.Defn.Expr do
730730
end)
731731
end
732732

733-
# TODO: Use Range.split/2 when we require Elixir v1.15+
734-
defp split_range(first..last//step = range, split) when is_integer(split) do
735-
if split >= 0 do
736-
split_range(first, last, step, split)
737-
else
738-
split_range(first, last, step, Range.size(range) + split)
739-
end
740-
end
741-
742-
defp split_range(first, last, step, split) when first < last or (first == last and step > 0) do
743-
if step > 0 do
744-
mid = max(min(first + step * (split - 1), last), first - step)
745-
{first..mid//step, (mid + step)..last//step}
746-
else
747-
{first..(first - step)//step, (last + step)..last//step}
748-
end
749-
end
750-
751-
defp split_range(last, first, step, split) do
752-
if step < 0 do
753-
mid = min(max(last + step * (split - 1), first), last - step)
754-
{last..mid//step, (mid + step)..first//step}
755-
else
756-
{last..(last - step)//step, (first + step)..first//step}
757-
end
758-
end
759-
760733
defp compatible_while!(file, line, initial, body) do
761734
if not Nx.compatible?(initial, body) do
762735
raise CompileError,

nx/lib/nx/serving.ex

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,7 @@ defmodule Nx.Serving do
768768
end
769769
end)
770770

771-
# TODO: Use Process.monitor/2 on Elixir v1.15+
772-
{pid, :erlang.monitor(:process, pid, alias: :demonitor)}
771+
{pid, Process.monitor(pid, alias: :demonitor)}
773772
end
774773

775774
defp run_hook(ref, size, result, hook) do
@@ -1038,8 +1037,7 @@ defmodule Nx.Serving do
10381037

10391038
{preprocessed, info} = handle_preprocessing(preprocessing, input)
10401039

1041-
# TODO: Use Process.monitor/2 on Elixir v1.15+
1042-
ref = :erlang.monitor(:process, pid, alias: :demonitor)
1040+
ref = Process.monitor(pid, alias: :demonitor)
10431041

10441042
size_or_unknown =
10451043
case preprocessed do
@@ -1396,8 +1394,7 @@ defmodule Nx.Serving do
13961394

13971395
@impl true
13981396
def handle_info({__MODULE__, :proxy_monitor, pid, ref}, state) do
1399-
# TODO: Use Process.monitor/2 on Elixir v1.15+
1400-
:erlang.monitor(:process, pid, tag: {:proxy, ref})
1397+
Process.monitor(pid, tag: {:proxy, ref})
14011398
{:noreply, state}
14021399
end
14031400

0 commit comments

Comments
 (0)