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

Add more example scripts #193

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add more example scripts #193

wants to merge 1 commit into from

Conversation

abieler
Copy link
Contributor

@abieler abieler commented Jul 15, 2021

  • rename examples/gcn.jl --> examples/gcn_gpu.jl. (this actually does not run, but IDK if its my setup or a bug)
  • added examples/gcn.jl (original example but w/o the |> gpu parts
  • added examples/gcn_featured_graph.jl (was a little more tedious to figure out how to make this work than i hoped from the docs alone)
  • note Dropout is broken for the FeaturedGraph example

@CarloLucibello
Copy link
Member

rename examples/gcn.jl --> examples/gcn_gpu.jl. (this actually does not run, but IDK if its my setup or a bug)
added examples/gcn.jl (original example but w/o the |> gpu parts

this seems a wasteful code duplication. You could just add a use_cuda flag, see e.g. https://github.com/FluxML/model-zoo/blob/master/vision/mlp_mnist/mlp_mnist.jl

## Model
model = Chain(
GCNConv(num_features=>hidden, relu),
# Dropout(0.5), --> does not work
Copy link
Member

Choose a reason for hiding this comment

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

what's the error?


## Loss
loss(x, y) = logitcrossentropy(model(x), y)
accuracy(x, y) = mean(onecold(softmax(cpu(model(x)))) .== onecold(cpu(y)))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
accuracy(x, y) = mean(onecold(softmax(cpu(model(x)))) .== onecold(cpu(y)))
accuracy(x, y) = mean(onecold(cpu(model(x))) .== onecold(cpu(y)))

Copy link
Member

Choose a reason for hiding this comment

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

onecold doesn't need normalized predictions

@yuehhua
Copy link
Member

yuehhua commented Jul 19, 2021

For GCNConv, if you pass it a FeaturedGraph, it will return you a FeaturedGraph. If you pass it an array, it will give you an array back. So, in the context of input being a FeaturedGraph, a Flux layer should not being used in the network, or you should pass it by bypass_graph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants