diff options
author | Asim Shankar <ashankar@google.com> | 2016-09-28 10:37:31 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-09-28 11:48:45 -0700 |
commit | 7cacfdf03872c36cfc3f43e75e8c342234160e3a (patch) | |
tree | 0856b1decb0a1f36a68450c9a5d9b825de999c06 /tensorflow/go/session.go | |
parent | b410f52f6616e281d8274317938a258605ad993a (diff) |
go: Add an example.
Add an example (that will appear in Go doc) for a real use of the Go TensorFlow
APIs - using a pre-defined image recognition model for inference.
While at it a couple of minor tweaks:
- NewSession now accepts 'nil' for options as the documentation says it does
- Convenience accessors for the Outputs of an Operation
- Ability to extract (possibly partial) shapes from an Output
Another step towards #10
Change: 134560938
Diffstat (limited to 'tensorflow/go/session.go')
-rw-r--r-- | tensorflow/go/session.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tensorflow/go/session.go b/tensorflow/go/session.go index 41b6ad4683..83dbbd8c04 100644 --- a/tensorflow/go/session.go +++ b/tensorflow/go/session.go @@ -180,6 +180,9 @@ type SessionOptions struct { // deallocate by calling C.TF_DeleteSessionOptions(). func (o *SessionOptions) c() *C.TF_SessionOptions { opt := C.TF_NewSessionOptions() + if o == nil { + return opt + } t := C.CString(o.Target) C.TF_SetTarget(opt, t) C.free(unsafe.Pointer(t)) |