Skip to content

Commit

Permalink
remove cast rrule not needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
CarloLucibello committed Feb 24, 2022
1 parent dd4a54c commit 2be04f3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
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

0 comments on commit 2be04f3

Please sign in to comment.