Avoid materializing I, simplify _eyelike with CUDA and make it differentiable#1254
Open
DhairyaLGandhi wants to merge 4 commits intomasterfrom
Open
Avoid materializing I, simplify _eyelike with CUDA and make it differentiable#1254DhairyaLGandhi wants to merge 4 commits intomasterfrom
I, simplify _eyelike with CUDA and make it differentiable#1254DhairyaLGandhi wants to merge 4 commits intomasterfrom
Conversation
ToucheSir
reviewed
Jun 26, 2022
Member
ToucheSir
left a comment
There was a problem hiding this comment.
Do you have a link or other reference to what inspired this PR? The changes make sense to me, but given the only place _eyelike is called is not AD-safe in the first place, I'm confused as to the need for making only it differentiable.
| end | ||
|
|
||
| @adjoint (::Type{T})(xs::Array) where {T <: CUDA.CuArray} = | ||
| _eyelike(y::CUDA.CuVector{T}) where T = CUDA.CuArray(I(length(y))) |
Member
There was a problem hiding this comment.
Suggested change
| _eyelike(y::CUDA.CuVector{T}) where T = CUDA.CuArray(I(length(y))) | |
| _eyelike(y::CUDA.CuVector) = CUDA.CuArray(I(length(y))) |
To avoid the unbound type param.
|
|
||
| @adjoint (::Type{T})(xs::Array) where {T <: CUDA.CuArray} = | ||
| _eyelike(y::CUDA.CuVector{T}) where T = CUDA.CuArray(I(length(y))) | ||
| @adjoint (::Type{T})(xs::AbstractArray) where {T <: CUDA.CuArray} = |
Member
There was a problem hiding this comment.
IIUC the intent of the PR, would we not want a dedicated path UniformScaling? Taking <:AbstractArray presumes we can convert back to that subtype, but the implementation can only convert back to Array at present. Adapt.jl may be able to help us here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.