Skip to content

Instantly share code, notes, and snippets.

@plutov
Created January 8, 2018 10:35
Show Gist options
  • Save plutov/e0b0afbdfde3261232fa8af90008f849 to your computer and use it in GitHub Desktop.
Save plutov/e0b0afbdfde3261232fa8af90008f849 to your computer and use it in GitHub Desktop.
tensorflow5.go
// Create a session for inference over modelGraph.
session, err := tf.NewSession(modelGraph, nil)
if err != nil {
log.Fatalf("could not init session: %v", err)
}
defer session.Close()
output, err := session.Run(
map[tf.Output]*tf.Tensor{
modelGraph.Operation("input").Output(0): tensor,
},
[]tf.Output{
modelGraph.Operation("output").Output(0),
},
nil)
if err != nil {
log.Fatalf("could not run inference: %v", err)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment