NewSession creates a new execution session with the associated graph. options may be nil to use the default options.
(graph *Graph, options *SessionOptions)
| 49 | // NewSession creates a new execution session with the associated graph. |
| 50 | // options may be nil to use the default options. |
| 51 | func NewSession(graph *Graph, options *SessionOptions) (*Session, error) { |
| 52 | status := newStatus() |
| 53 | cOpt, doneOpt, err := options.c() |
| 54 | defer doneOpt() |
| 55 | if err != nil { |
| 56 | return nil, err |
| 57 | } |
| 58 | cSess := C.TF_NewSession(graph.c, cOpt, status.c) |
| 59 | if err := status.Err(); err != nil { |
| 60 | return nil, err |
| 61 | } |
| 62 | |
| 63 | s := &Session{c: cSess} |
| 64 | runtime.SetFinalizer(s, func(s *Session) { s.Close() }) |
| 65 | return s, nil |
| 66 | } |
| 67 | |
| 68 | // Device structure contains information about a device associated with a session, as returned by ListDevices() |
| 69 | type Device struct { |