@@ -56,9 +56,7 @@ and require expensive copies and synchronization each time and therefore should
56
56
return TracedRArray {T,0} ((), res2, ())
57
57
end
58
58
59
- function Base. getindex (
60
- a:: TracedRArray{T,N} , indices:: Vararg{Any,N}
61
- ) where {T,N}
59
+ function Base. getindex (a:: TracedRArray{T,N} , indices:: Vararg{Any,N} ) where {T,N}
62
60
indices = [i isa Colon ? (1 : size (a, idx)) : i for (idx, i) in enumerate (indices)]
63
61
res = MLIR. IR. result (
64
62
MLIR. Dialects. stablehlo. slice (
@@ -73,20 +71,16 @@ function Base.getindex(
73
71
)
74
72
x = TracedRArray {T,N} ((), res, Tuple (length .(indices)))
75
73
ddims = findall (x -> x isa Integer, indices)
76
- ! isempty (ddims) && return dropdims (x, dims= Tuple (ddims))
74
+ ! isempty (ddims) && return dropdims (x; dims= Tuple (ddims))
77
75
return x
78
76
end
79
77
80
78
# Prevents ambiguity
81
- function Base. getindex (
82
- a:: SubArray{T,N,<:AnyTracedRArray{T,N}} , indices:: Int...
83
- ) where {T,N}
79
+ function Base. getindex (a:: SubArray{T,N,<:AnyTracedRArray{T,N}} , indices:: Int... ) where {T,N}
84
80
return getindex (parent (a), Base. reindex (a. indices, indices)... )
85
81
end
86
82
87
- function Base. getindex (
88
- a:: SubArray{T,N,<:AnyTracedRArray{T,N}} , indices...
89
- ) where {T,N}
83
+ function Base. getindex (a:: SubArray{T,N,<:AnyTracedRArray{T,N}} , indices... ) where {T,N}
90
84
return getindex (parent (a), Base. reindex (a. indices, indices)... )
91
85
end
92
86
0 commit comments