From a7667a7218df3fe401b1fc834d4b084f735062d1 Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Mon, 13 Aug 2018 07:45:47 -0400 Subject: [PATCH] Fix adapt of Adjoint --- README.md | 2 +- src/Adapt.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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