Skip to content

Commit 6c3c79c

Browse files
committed
also fix two unrelated docstring which just told you what the function was called without explaining anything
1 parent 23613d6 commit 6c3c79c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/utils.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
"""
22
safe_div(x, y)
33
4-
Safely divide `x` by `y`. If `y` is zero, return `x` directly.
4+
Returns `x/y` unless `y==0`, in which case it just returns `x`.
5+
(Used internally by `scatter`.)
56
"""
67
safe_div(x, y) = ifelse(iszero(y), x, x/y)
78

89
"""
910
maximum_dims(dims)
1011
11-
Return the maximum value for each dimension. An array of dimensions `dims` is accepted.
12-
The maximum of each dimension in the element is computed.
12+
Given an array of `CartesianIndex{N}` or `NTuple{N,Int}`,
13+
returns a tuple containing the maximum of the 1st entries,
14+
the 2nd, and so on up to `N`.
15+
16+
Given an array of integers, returns `(maximum(dims),)`.
17+
18+
(These arguments are what [`scatter`](@ref NNlib.scatter) understands.)
1319
"""
1420
maximum_dims(dims::AbstractArray{<:Integer}) = (maximum(dims), )
1521
maximum_dims(dims::AbstractArray{NTuple{N, T}}) where {N,T} = ntuple(i -> maximum(x->x[i], dims), N)

0 commit comments

Comments
 (0)