Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm adjoint & transpose adjoints #1259

Merged
merged 2 commits into from
Jul 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 1 addition & 26 deletions src/lib/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -337,33 +337,8 @@ 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(ȳ),)
@adjoint parent(x::LinearAlgebra.Transpose) = parent(x), ȳ -> (LinearAlgebra.Transpose(ȳ),)

function _kron(mat1::AbstractMatrix,mat2::AbstractMatrix)
m1, n1 = size(mat1)
Expand Down