Skip to content

Commit c5a23ab

Browse files
authored
Fix documentation formatting (#1555)
1 parent 4936aa0 commit c5a23ab

File tree

1 file changed

+49
-49
lines changed

1 file changed

+49
-49
lines changed

nx/lib/nx.ex

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8682,7 +8682,7 @@ defmodule Nx do
86828682
You may set the absolute tolerance, `:atol` and relative tolerance
86838683
`:rtol`. Given tolerances, this functions returns 1 if
86848684
8685-
absolute(a - b) <= (atol + rtol * absolute(b))
8685+
absolute(a - b) <= (atol + rtol * absolute(b))
86868686
86878687
is true for all elements of a and b.
86888688
@@ -8695,67 +8695,67 @@ defmodule Nx do
86958695
86968696
## Examples
86978697
8698-
iex> Nx.all_close(Nx.tensor([1.0e10, 1.0e-7]), Nx.tensor([1.00001e10, 1.0e-8]))
8699-
#Nx.Tensor<
8700-
u8
8701-
0
8702-
>
8698+
iex> Nx.all_close(Nx.tensor([1.0e10, 1.0e-7]), Nx.tensor([1.00001e10, 1.0e-8]))
8699+
#Nx.Tensor<
8700+
u8
8701+
0
8702+
>
87038703
8704-
iex> Nx.all_close(Nx.tensor([1.0e-8, 1.0e-8]), Nx.tensor([1.0e-8, 1.0e-9]))
8705-
#Nx.Tensor<
8706-
u8
8707-
1
8708-
>
8704+
iex> Nx.all_close(Nx.tensor([1.0e-8, 1.0e-8]), Nx.tensor([1.0e-8, 1.0e-9]))
8705+
#Nx.Tensor<
8706+
u8
8707+
1
8708+
>
87098709
87108710
Although `NaN` by definition isn't equal to itself, so this implementation
87118711
also considers all `NaN`s different from each other by default:
87128712
8713-
iex> Nx.all_close(Nx.tensor(:nan), Nx.tensor(:nan))
8714-
#Nx.Tensor<
8715-
u8
8716-
0
8717-
>
8713+
iex> Nx.all_close(Nx.tensor(:nan), Nx.tensor(:nan))
8714+
#Nx.Tensor<
8715+
u8
8716+
0
8717+
>
87188718
8719-
iex> Nx.all_close(Nx.tensor(:nan), Nx.tensor(0))
8720-
#Nx.Tensor<
8721-
u8
8722-
0
8723-
>
8719+
iex> Nx.all_close(Nx.tensor(:nan), Nx.tensor(0))
8720+
#Nx.Tensor<
8721+
u8
8722+
0
8723+
>
87248724
87258725
We can change this behavior with the `:equal_nan` option:
87268726
8727-
iex> t = Nx.tensor([:nan, 1])
8728-
iex> Nx.all_close(t, t, equal_nan: true) # nan == nan -> true
8729-
#Nx.Tensor<
8730-
u8
8731-
1
8732-
>
8733-
iex> Nx.all_close(t, t, equal_nan: false) # nan == nan -> false, default behavior
8734-
#Nx.Tensor<
8735-
u8
8736-
0
8737-
>
8727+
iex> t = Nx.tensor([:nan, 1])
8728+
iex> Nx.all_close(t, t, equal_nan: true) # nan == nan -> true
8729+
#Nx.Tensor<
8730+
u8
8731+
1
8732+
>
8733+
iex> Nx.all_close(t, t, equal_nan: false) # nan == nan -> false, default behavior
8734+
#Nx.Tensor<
8735+
u8
8736+
0
8737+
>
87388738
87398739
Infinities behave as expected, being "close" to themselves but not
87408740
to other numbers:
87418741
8742-
iex> Nx.all_close(Nx.tensor(:infinity), Nx.tensor(:infinity))
8743-
#Nx.Tensor<
8744-
u8
8745-
1
8746-
>
8747-
8748-
iex> Nx.all_close(Nx.tensor(:infinity), Nx.tensor(:neg_infinity))
8749-
#Nx.Tensor<
8750-
u8
8751-
0
8752-
>
8753-
8754-
iex> Nx.all_close(Nx.tensor(1.0e30), Nx.tensor(:infinity))
8755-
#Nx.Tensor<
8756-
u8
8757-
0
8758-
>
8742+
iex> Nx.all_close(Nx.tensor(:infinity), Nx.tensor(:infinity))
8743+
#Nx.Tensor<
8744+
u8
8745+
1
8746+
>
8747+
8748+
iex> Nx.all_close(Nx.tensor(:infinity), Nx.tensor(:neg_infinity))
8749+
#Nx.Tensor<
8750+
u8
8751+
0
8752+
>
8753+
8754+
iex> Nx.all_close(Nx.tensor(1.0e30), Nx.tensor(:infinity))
8755+
#Nx.Tensor<
8756+
u8
8757+
0
8758+
>
87598759
87608760
## Vectorized tensors
87618761

0 commit comments

Comments
 (0)