Skip to content

Commit

Permalink
Use broadcasting to construct the TracedRArray
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed May 27, 2024
1 parent f23abb5 commit 08d36f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Reactant.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ abstract type RArray{ElType,Shape,N} <: AbstractArray{ElType, N} end

@inline Base.eltype(::RArray{ElType,Shape}) where {ElType, Shape} = ElType
@inline Base.size(::RArray{ElType,Shape}) where {ElType, Shape} = Shape
@inline Base.size(::Type{<:RArray{ElType,Shape}}) where {ElType, Shape} = Shape
@inline Base.ndims(::RArray{ElType,Shape, N}) where {ElType, Shape, N} = N
@inline Base.ndims(::Type{<:RArray{ElType,Shape, N}}) where {ElType, Shape, N} = N

Expand Down Expand Up @@ -140,8 +141,7 @@ end
end

if RT <: TracedRArray
@assert typeof(prev) <: RT # prev has concrete shape while RT might not have that
res = typeof(prev)(prev.paths, prev.mlir_data)
res = broadcast_to_size(eltype(RT)(0), size(prev))
seen[prev] = res
return res
end
Expand Down

0 comments on commit 08d36f8

Please sign in to comment.