MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / NewSession

Function NewSession

tensorflow/go/session.go:51–66  ·  view source on GitHub ↗

NewSession creates a new execution session with the associated graph. options may be nil to use the default options.

(graph *Graph, options *SessionOptions)

Source from the content-addressed store, hash-verified

49// NewSession creates a new execution session with the associated graph.
50// options may be nil to use the default options.
51func 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()
69type Device struct {

Callers 15

TestGraphAddGradientsFunction · 0.70
TestSessionRunNegFunction · 0.70
TestSessionRunConcatFunction · 0.70
TestConcurrencyFunction · 0.70
ExamplePartialRunFunction · 0.70
TestSessionConfigFunction · 0.70
TestListDevicesFunction · 0.70
CreateSessionMethod · 0.50
InitializeSessionFunction · 0.50

Calls 4

CloseMethod · 0.95
newStatusFunction · 0.85
cMethod · 0.45
ErrMethod · 0.45

Tested by 15

TestGraphAddGradientsFunction · 0.56
TestSessionRunNegFunction · 0.56
TestSessionRunConcatFunction · 0.56
TestConcurrencyFunction · 0.56
ExamplePartialRunFunction · 0.56
TestSessionConfigFunction · 0.56
TestListDevicesFunction · 0.56
TestConstantFoldingMethod · 0.40