Skip to content

Commit eee9a37

Browse files
committed
also fix two unrelated docstring which just told you what the function was called without explaining anything
1 parent c464ea4 commit eee9a37

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
@@ -53,15 +53,21 @@ ChainRulesCore.rrule(::typeof(within_gradient), x) = true, _ -> (NoTangent(), No
5353
"""
5454
safe_div(x, y)
5555
56-
Safely divide `x` by `y`. If `y` is zero, return `x` directly.
56+
Returns `x/y` unless `y==0`, in which case it just returns `x`.
57+
(Used internally by `scatter`.)
5758
"""
5859
safe_div(x, y) = ifelse(iszero(y), x, x/y)
5960

6061
"""
6162
maximum_dims(dims)
6263
63-
Return the maximum value for each dimension. An array of dimensions `dims` is accepted.
64-
The maximum of each dimension in the element is computed.
64+
Given an array of `CartesianIndex{N}` or `NTuple{N,Int}`,
65+
returns a tuple containing the maximum of the 1st entries,
66+
the 2nd, and so on up to `N`.
67+
68+
Given an array of integers, returns `(maximum(dims),)`.
69+
70+
(These arguments are what [`scatter`](@ref NNlib.scatter) understands.)
6571
"""
6672
maximum_dims(dims::AbstractArray{<:Integer}) = (maximum(dims), )
6773
maximum_dims(dims::AbstractArray{NTuple{N, T}}) where {N,T} = ntuple(i -> maximum(x->x[i], dims), N)

0 commit comments

Comments
 (0)