Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonOresten committed Sep 18, 2024
1 parent 55a66e5 commit a045b64
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/RandomFeatureMaps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ end
_rof(rof::RandomOrientationFeatures, T1::Rigid, T2::Rigid) = norms(T1(rof.FA) .- T2(rof.FB); dims=1)

function (rof::RandomOrientationFeatures)(T1::Rigid, T2::Rigid; pairdim::Union{Nothing,Int}=nothing)
if dims isa Int
if pairdim isa Int
T1, T2 = batchunsqueeze(T1, dims=pairdim+1), batchunsqueeze(T2, dims=pairdim)
end
_rof(rof, T1, T2)
Expand Down
4 changes: 2 additions & 2 deletions test/GraphNeuralNetworksExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using GraphNeuralNetworks
g = ones(Bool, n, n)
graph = GNNGraph(g, graph_type=:dense)
rof = RandomOrientationFeatures(dim, 0.1f0)
@test rof(rigid, graph) == reshape(rof(rigid; dims=1), dim, :)
@test rof(rigid, graph) == reshape(rof(rigid; pairdim=1), dim, :)
end

@testset "Random edges" begin
Expand All @@ -20,7 +20,7 @@ using GraphNeuralNetworks
graph = GNNGraph(g, graph_type=:dense)
rof = RandomOrientationFeatures(dim, 0.1f0)
@test size(rof(rigid, rigid, graph), 2) == count(g)
@test rof(rigid, graph) == reshape(rof(rigid; dims=1), dim, :)[:,findall(vec(g))]
@test rof(rigid, graph) == reshape(rof(rigid; pairdim=1), dim, :)[:,findall(vec(g))]
@test rof(rigid, graph) == rof(rigid, rigid, graph)
end

Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ using BatchedTransformations
k = 5
rof = RandomOrientationFeatures(dim, 0.1f0)
rigid = rand_rigid(Float32, (n,k))
@test rof(rigid, dims=1) |> size == (dim, n, n, k)
@test rof((rand(3,3,n,k), rand(3,1,n,k)), dims=1) |> size == (dim, n, n, k)
@test rof(rigid, pairdim=1) |> size == (dim, n, n, k)
@test rof((rand(3,3,n,k), rand(3,1,n,k)), pairdim=1) |> size == (dim, n, n, k)
@test rof(rigid) == rof(rigid, rigid)
end

Expand Down

2 comments on commit a045b64

@AntonOresten
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

  • Changed behavior of (::RandomOrientationFeatures) methods; rof(rigid) needs to be updated to rof(rigid; pairdim=1).

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/115394

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.0 -m "<description of version>" a045b641f480f4d96847ab1ac134bafb62a9bea9
git push origin v0.2.0

Please sign in to comment.