Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repeat(X; outer, inner) triggers scalar indexing error with CUDA #1459

Closed
vpuri3 opened this issue Oct 4, 2023 · 1 comment
Closed

repeat(X; outer, inner) triggers scalar indexing error with CUDA #1459

vpuri3 opened this issue Oct 4, 2023 · 1 comment

Comments

@vpuri3
Copy link

vpuri3 commented Oct 4, 2023

Zygote.jl/src/lib/array.jl

Lines 127 to 141 in cf7f7d0

@adjoint function repeat(xs; inner=ntuple(_->1, ndims(xs)), outer=ntuple(_->1, ndims(xs)))
repeat(xs, inner = inner, outer = outer), function (Δ)
Δ′ = zero(xs)
S = size(xs)
# Loop through each element of Δ, calculate source dimensions, accumulate into Δ′
for (dest_idx, val) in pairs(IndexCartesian(), Δ)
# First, round dest_idx[dim] to nearest gridpoint defined by inner[dim], then
# wrap around based on original size S.
src_idx = [mod1(div(dest_idx[dim] - 1, inner[dim]) + 1, S[dim]) for dim in 1:length(S)]
Δ′[src_idx...] += val
end
return (Δ′,)
end
end

@ToucheSir
Copy link
Member

Duplicate of #1442

@ToucheSir ToucheSir marked this as a duplicate of #1442 Oct 4, 2023
@ToucheSir ToucheSir closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants