Skip to content

Commit

Permalink
Correctly dispatch on type (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
sethaxen authored May 14, 2020
1 parent 629fad5 commit a635413
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/buffer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ end
grad_mut(b::Buffer) = fill!(similar(b.data, Any), nothing)
grad_mut(b::Buffer{T}) where T<:Number = fill!(similar(b.data, float(T)), 0)

function ZygoteRules._pullback(cx::AContext, ::typeof(Buffer), args...)
Buffer(args...), _ -> nothing
function ZygoteRules._pullback(cx::AContext, ::Type{T}, args...) where {T<:Buffer}
T(args...), _ -> nothing
end

@adjoint function getindex(b::Buffer, i...)
Expand Down

0 comments on commit a635413

Please sign in to comment.