Skip to content

Commit 67861f1

Browse files
fix: handle edge case in ChainRulesCoreExt
1 parent 8901b93 commit 67861f1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ext/MTKChainRulesCoreExt.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ 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) for idx in idxs if idx.portion == portion && idx.idx[1] == subi]
20+
if isempty(result)
21+
result = []
22+
end
23+
result
2024
end
2125
end
2226

0 commit comments

Comments
 (0)