Skip to content

Commit fb89cf4

Browse files
committed
Silence type system warnings
1 parent 84a2ef1 commit fb89cf4

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

nx/lib/nx/defn/composite.ex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule Nx.Defn.Composite do
33
Functions to deal with composite data types.
44
55
Composite data-types are traversed according to `Nx.Container`.
6-
If a regular tensor is given, it is individually traversed.
6+
If a regular tensor is given, it is individually traversed.
77
Numerical values, such as integers, floats, and complex numbers
88
are not normalized before hand. Use `Nx.to_tensor/1` to do so.
99
@@ -42,8 +42,10 @@ defmodule Nx.Defn.Composite do
4242
{left, right} =
4343
case Nx.LazyContainer.impl_for(left) do
4444
Nx.LazyContainer.Any ->
45-
left = Nx.Container.reduce(left, [], &[&1 | &2])
46-
right = Nx.Container.reduce(right, [], &[&1 | &2])
45+
# Avoid type system warning because, when compiling Nx itself,
46+
# the lazy containers are the same as containers.
47+
left = Nx.Container.reduce(Function.identity(left), [], &[&1 | &2])
48+
right = Nx.Container.reduce(Function.identity(right), [], &[&1 | &2])
4749
{left, right}
4850

4951
impl ->

0 commit comments

Comments
 (0)