Skip to content

Commit

Permalink
test: add test for limit: :infinity in Nx.Defn.Expr
Browse files Browse the repository at this point in the history
  • Loading branch information
polvalente committed Jul 27, 2023
1 parent 101be51 commit 2771b27
Showing 1 changed file with 19 additions and 29 deletions.
48 changes: 19 additions & 29 deletions nx/test/nx/defn/expr_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -405,37 +405,27 @@ defmodule Nx.Defn.ExprTest do

result = add_sub_mult_no_tokens(t, t, t, t)

full_expr = """
#Nx.Tensor<
f32
\s\s
Nx.Defn.Expr
parameter a:0 f32
parameter b:1 f32
parameter d:2 f32
parameter f:3 f32
c = add a, b f32
e = subtract c, d f32
g = multiply e, f f32
>\
"""

# infinity
assert inspect(result, limit: :infinity) == full_expr
# greater than the number of exprs
assert inspect(result, limit: 8) == """
#Nx.Tensor<
f32
\s\s
Nx.Defn.Expr
parameter a:0 f32
parameter b:1 f32
parameter d:2 f32
parameter f:3 f32
c = add a, b f32
e = subtract c, d f32
g = multiply e, f f32
>\
"""

assert inspect(result, limit: 8) == full_expr
# equal to the number of exprs
assert inspect(result, limit: 7) == """
#Nx.Tensor<
f32
\s\s
Nx.Defn.Expr
parameter a:0 f32
parameter b:1 f32
parameter d:2 f32
parameter f:3 f32
c = add a, b f32
e = subtract c, d f32
g = multiply e, f f32
>\
"""
assert inspect(result, limit: 7) == full_expr

# one less than the number of exprs
assert inspect(result, limit: 6) == """
Expand Down

0 comments on commit 2771b27

Please sign in to comment.