Skip to content

Commit b1d7b46

Browse files
authored
make sure we still error if the primal code errored
1 parent a1a70cc commit b1d7b46

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/rulesets/Base/mapreduce.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,13 @@ end
325325
##### `cumprod`
326326
#####
327327

328-
function rrule(::typeof(cumprod), x::AbstractArray{<:Real}; dims::Integer=1)
328+
function rrule(::typeof(cumprod), x::AbstractArray{<:Real}; dims::Integer=nothing)
329+
if isnothing(dims) && ndims(x)==1
330+
dims=1
331+
else
332+
throw(UndefKeywordError(:dims)
333+
end
334+
329335
y = cumprod(x; dims=dims)
330336
project_x = ProjectTo(x)
331337
function cumprod_pullback(dy_raw)

0 commit comments

Comments
 (0)