From bdefedc81a5ae44448f1d2d92ae42bb3230308f5 Mon Sep 17 00:00:00 2001 From: Michael Abbott <32575566+mcabbott@users.noreply.github.com> Date: Sun, 3 Jul 2022 11:03:20 -0600 Subject: [PATCH 1/2] rm adjoint + transpose adjoint --- src/lib/array.jl | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/lib/array.jl b/src/lib/array.jl index 0eef0c64a..305c46832 100644 --- a/src/lib/array.jl +++ b/src/lib/array.jl @@ -337,34 +337,6 @@ end # LinearAlgebra # ============= -@adjoint function transpose(x) - back(Δ) = (transpose(Δ),) - back(Δ::NamedTuple{(:parent,)}) = (Δ.parent,) - return transpose(x), back -end - -@adjoint function LinearAlgebra.Transpose(x) - back(Δ) = (LinearAlgebra.Transpose(Δ),) - back(Δ::NamedTuple{(:parent,)}) = (Δ.parent,) - return LinearAlgebra.Transpose(x), back -end - - -@adjoint function Base.adjoint(x) - back(Δ) = (Δ',) - back(Δ::NamedTuple{(:parent,)}) = (Δ.parent,) - return x', back -end - -@adjoint function LinearAlgebra.Adjoint(x) - back(Δ) = (LinearAlgebra.Adjoint(Δ),) - back(Δ::NamedTuple{(:parent,)}) = (Δ.parent,) - return LinearAlgebra.Adjoint(x), back -end - -@adjoint parent(x::LinearAlgebra.Adjoint) = parent(x), ȳ -> (LinearAlgebra.Adjoint(ȳ),) -@adjoint parent(x::LinearAlgebra.Transpose) = parent(x), ȳ -> (LinearAlgebra.Transpose(ȳ),) - function _kron(mat1::AbstractMatrix,mat2::AbstractMatrix) m1, n1 = size(mat1) mat1_rsh = reshape(mat1,(1,m1,1,n1)) From 26ae24b9cb104428d7e69e4717810a6917dc15e6 Mon Sep 17 00:00:00 2001 From: Michael Abbott <32575566+mcabbott@users.noreply.github.com> Date: Sun, 3 Jul 2022 11:37:06 -0600 Subject: [PATCH 2/2] restore parent adjoints --- src/lib/array.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/array.jl b/src/lib/array.jl index 305c46832..e4079eb89 100644 --- a/src/lib/array.jl +++ b/src/lib/array.jl @@ -337,6 +337,9 @@ end # LinearAlgebra # ============= +@adjoint parent(x::LinearAlgebra.Adjoint) = parent(x), ȳ -> (LinearAlgebra.Adjoint(ȳ),) +@adjoint parent(x::LinearAlgebra.Transpose) = parent(x), ȳ -> (LinearAlgebra.Transpose(ȳ),) + function _kron(mat1::AbstractMatrix,mat2::AbstractMatrix) m1, n1 = size(mat1) mat1_rsh = reshape(mat1,(1,m1,1,n1))