elixir-nx / nx

Multi-dimensional arrays (tensors) and numerical definitions for Elixir
2.66k stars 194 forks source link

Fix range with negative steps in matrix.ex #1527

Closed josevalim closed 2 months ago

josevalim commented 2 months ago

Here are the warnings (I believe those warnings are only from Elixir main, but they can be fixed without Elixir main). :)

warning: Range.new/2 has a default step of -1, please call Range.new/3 explicitly passing the step of -1 instead
  (nx 0.8.0) lib/nx/binary_backend/matrix.ex:209: Nx.BinaryBackend.Matrix.hessenberg_decomposition/3
  (nx 0.8.0) lib/nx/binary_backend/matrix.ex:175: Nx.BinaryBackend.Matrix.eigh/5
  (nx 0.8.0) lib/nx/binary_backend.ex:1254: anonymous fn/6 in Nx.BinaryBackend.eigh/3
  (elixir 1.18.0-dev) lib/enum.ex:4489: Enum.reduce/3
  (nx 0.8.0) lib/nx/binary_backend.ex:1253: Nx.BinaryBackend.eigh/3
  (nx 0.8.0) lib/nx/defn/evaluator.ex:405: Nx.Defn.Evaluator.eval_apply/4
  (nx 0.8.0) lib/nx/defn/evaluator.ex:256: Nx.Defn.Evaluator.eval/3
  (nx 0.8.0) lib/nx/defn/evaluator.ex:319: Nx.Defn.Evaluator.eval_apply/4
  (nx 0.8.0) lib/nx/defn/evaluator.ex:256: Nx.Defn.Evaluator.eval/3
  (elixir 1.18.0-dev) lib/enum.ex:1829: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
  (nx 0.8.0) lib/nx/defn/evaluator.ex:419: Nx.Defn.Evaluator.eval_apply/4
  (nx 0.8.0) lib/nx/defn/evaluator.ex:256: Nx.Defn.Evaluator.eval/3
  (elixir 1.18.0-dev) lib/enum.ex:1829: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
  (nx 0.8.0) lib/nx/defn/evaluator.ex:419: Nx.Defn.Evaluator.eval_apply/4
  (nx 0.8.0) lib/nx/defn/evaluator.ex:256: Nx.Defn.Evaluator.eval/3
  (elixir 1.18.0-dev) lib/enum.ex:1829: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
  (nx 0.8.0) lib/nx/defn/evaluator.ex:419: Nx.Defn.Evaluator.eval_apply/4

warning: Range.new/2 has a default step of -1, please call Range.new/3 explicitly passing the step of -1 instead
  (nx 0.8.0) lib/nx/binary_backend/matrix.ex:124: Nx.BinaryBackend.Matrix.qr_decomposition/4
  (nx 0.8.0) lib/nx/binary_backend/matrix.ex:181: anonymous fn/4 in Nx.BinaryBackend.Matrix.eigh/5
  (elixir 1.18.0-dev) lib/range.ex:552: Enumerable.Range.reduce/5
  (elixir 1.18.0-dev) lib/enum.ex:2589: Enum.reduce_while/3
  (nx 0.8.0) lib/nx/binary_backend/matrix.ex:179: Nx.BinaryBackend.Matrix.eigh/5
  (nx 0.8.0) lib/nx/binary_backend.ex:1254: anonymous fn/6 in Nx.BinaryBackend.eigh/3
  (elixir 1.18.0-dev) lib/enum.ex:4489: Enum.reduce/3
  (nx 0.8.0) lib/nx/binary_backend.ex:1253: Nx.BinaryBackend.eigh/3
  (nx 0.8.0) lib/nx/defn/evaluator.ex:405: Nx.Defn.Evaluator.eval_apply/4
  (nx 0.8.0) lib/nx/defn/evaluator.ex:256: Nx.Defn.Evaluator.eval/3
  (nx 0.8.0) lib/nx/defn/evaluator.ex:319: Nx.Defn.Evaluator.eval_apply/4
  (nx 0.8.0) lib/nx/defn/evaluator.ex:256: Nx.Defn.Evaluator.eval/3
  (elixir 1.18.0-dev) lib/enum.ex:1829: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
  (nx 0.8.0) lib/nx/defn/evaluator.ex:419: Nx.Defn.Evaluator.eval_apply/4
  (nx 0.8.0) lib/nx/defn/evaluator.ex:256: Nx.Defn.Evaluator.eval/3
  (elixir 1.18.0-dev) lib/enum.ex:1829: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
  (nx 0.8.0) lib/nx/defn/evaluator.ex:419: Nx.Defn.Evaluator.eval_apply/4