From 44037c25a2bd5711edc7abfbe0736de1ff5d7e87 Mon Sep 17 00:00:00 2001 From: Ningxin Hu Date: Fri, 4 Sep 2026 15:40:47 -0700 Subject: [PATCH] Allow 0-D output for gather() The indices operand already allows rank 0, and the output rank is rank(input) + rank(indices) - 1. So a rank-1 input gathered with scalar indices legitimately produces a rank-0 output, e.g. input of shape [4] with indices of shape [] and axis 0 yields output of shape []. The output row of the tensor limits table set the minimum rank to 1, which rejected that case. Relax it to allow rank 0, matching both the indices row and gatherND()'s output row. The algorithm steps needed no change; they already produce an empty output shape for this case. Fixes #946 --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 0a835d9e..5f0e0bc4 100644 --- a/index.bs +++ b/index.bs @@ -4928,8 +4928,8 @@ partial dictionary MLOpSupportLimits { *output* [=/same type as|same as=] {{input}} {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}, {{MLOperandDataType/"int32"}}, {{MLOperandDataType/"int8"}}, {{MLOperandDataType/"uint8"}} - 1 to [=/any rank|N=] - 1 to 5 + [=/any rank|N=] + 0 to 5