diff --git a/README.md b/README.md index 015bf38..aaf7a53 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ adapt(CuArray, ::Adjoint{Array})::Adjoint{CuArray} New data types like `Adjoint` should overload `adapt(T, ::Adjoint)` (usually just to forward the call to `adapt`). ```julia -adapt(T, x::Adjoint) = Adjoint(adapt(T, x.vec)) +adapt(T, x::Adjoint) = Adjoint(adapt(T, parent(x))) ``` New adaptor types like `CuArray` should overload `adapt_` for compatible types. diff --git a/src/Adapt.jl b/src/Adapt.jl index 9b2216c..e32688a 100644 --- a/src/Adapt.jl +++ b/src/Adapt.jl @@ -8,6 +8,6 @@ adapt(T, x) = adapt_(T, x) # Base integrations -adapt(T, x::Adjoint) = Adjoint(adapt(T, vec(x))) +adapt(T, x::Adjoint) = Adjoint(adapt(T, parent(x))) end # module