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

remove cast rrule not needed anymore #135

Merged
merged 1 commit into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,3 @@ function broadcast_edges(g::GNNGraph, x)
gi = graph_indicator(g, edges=true)
return gather(x, gi)
end

# More generic version of
# https://github.com/JuliaDiff/ChainRules.jl/pull/586
# This applies to all arrays
# Withouth this, gradient of T.(A) for A dense gpu matrix errors.
function ChainRulesCore.rrule(::typeof(Broadcast.broadcasted), T::Type{<:Number}, x::AbstractArray)
proj = ProjectTo(x)

function broadcasted_cast(Δ)
return NoTangent(), NoTangent(), proj(Δ)
end

return T.(x), broadcasted_cast
end
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ tests = [

!CUDA.functional() && @warn("CUDA unavailable, not testing GPU support")

@testset "GraphNeuralNetworks: graph format $graph_type" for graph_type in (:dense, :coo, :sparse)
@testset "GraphNeuralNetworks: graph format $graph_type" for graph_type in (:coo, :dense, :sparse)
global GRAPH_T = graph_type
global TEST_GPU = CUDA.functional() && (GRAPH_T != :sparse)

for t in tests
startswith(t, "examples") && GRAPH_T == :dense && continue # not testing :dense since causes OutOfMememory on github's CI
include("$t.jl")
Expand Down