Skip to content

Commit 96dd399

Browse files
fix: handle edge case in ChainRulesCoreExt
1 parent a7ffae5 commit 96dd399

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ext/MTKChainRulesCoreExt.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ end
1616

1717
function subset_idxs(idxs, portion, template)
1818
ntuple(Val(length(template))) do subi
19-
[Base.tail(idx.idx) for idx in idxs if idx.portion == portion && idx.idx[1] == subi]
19+
result = [Base.tail(idx.idx)
20+
for idx in idxs if idx.portion == portion && idx.idx[1] == subi]
21+
if isempty(result)
22+
result = []
23+
end
24+
result
2025
end
2126
end
2227

0 commit comments

Comments
 (0)