torch.GatherShape
export type GatherShape<
S extends Shape,
Dim extends number,
IndexShape extends Shape,
> = number extends Dim
? IndexShape
: number extends S['length']
? IndexShape
: LessThan<Dim, S['length']> extends true
? IndexShape // Valid - output has index's shape
: gather_error_dim_out_of_range<Dim, S['length']>;Sextends ShapeDimextends numberIndexShapeextends ShapeValidate gather dim is within bounds and compute output shape. gather output has same shape as index tensor.