Skip to content

Commit

Permalink
fix: import ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Oct 5, 2024
1 parent 36a6fea commit 40af781
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Reactant.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ include("XLA.jl")
include("Interpreter.jl")
include("utils.jl")
include("ConcreteRArray.jl")
include("TracedRArray.jl")
include("TracedRNumber.jl")
include("TracedRArray.jl")
include("Tracing.jl")
include("Compiler.jl")

Expand Down
8 changes: 4 additions & 4 deletions src/TracedRArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ end

promote_to(::TracedRArray{T,N}, rhs) where {T,N} = promote_to(TracedRArray{T,N}, rhs)

struct TypeCast{T<:Number} <: Function end

elem_apply(::Type{T}, x::TracedRArray{T}) where {T<:Number} = x
function elem_apply(::Type{T}, x::TracedRArray{T2}) where {T<:Number,T2<:Number}
elem_apply(::Type{T}, x::TracedRArray{T}) where {T<:ReactantPrimitives} = x
function elem_apply(
::Type{T}, x::TracedRArray{T2}
) where {T<:ReactantPrimitives,T2<:ReactantPrimitives}
# Special Path to prevent going down a despecialized path
return elem_apply(TypeCast{T}(), x)
end
Expand Down
2 changes: 2 additions & 0 deletions src/TracedRNumber.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ for (jlop, hloop) in (
end
end

struct TypeCast{T<:ReactantPrimitives} <: Function end

(::TypeCast{T})(x::TracedRNumber{T2}) where {T,T2} = promote_to(TracedRNumber{T}, x)

Base.float(x::TracedRNumber{T}) where {T} = promote_to(TracedRNumber{float(T)}, x)

0 comments on commit 40af781

Please sign in to comment.