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

Method Run

tensorflow/go/session.go:133–158  ·  view source on GitHub ↗

Run the graph with the associated session starting with the supplied feeds to compute the value of the requested fetches. Runs, but does not return Tensors for operations specified in targets. On success, returns the fetched Tensors in the same order as supplied in the fetches argument. If fetches

(feeds map[Output]*Tensor, fetches []Output, targets []*Operation)

Source from the content-addressed store, hash-verified

131// the fetches argument. If fetches is set to nil, the returned Tensor fetches
132// is empty.
133func (s *Session) Run(feeds map[Output]*Tensor, fetches []Output, targets []*Operation) ([]*Tensor, error) {
134 s.mu.Lock()
135 if s.c == nil {
136 s.mu.Unlock()
137 return nil, errors.New("session is closed")
138 }
139 s.wg.Add(1)
140 s.mu.Unlock()
141 defer s.wg.Done()
142
143 c := newCRunArgs(feeds, fetches, targets)
144 status := newStatus()
145 C.TF_SessionRun(s.c, nil,
146 ptrOutput(c.feeds), ptrTensor(c.feedTensors), C.int(len(feeds)),
147 ptrOutput(c.fetches), ptrTensor(c.fetchTensors), C.int(len(fetches)),
148 ptrOperation(c.targets), C.int(len(targets)),
149 nil, status.c)
150
151 // Make sure GC won't harvest input tensors until SessionRun() is finished
152 runtime.KeepAlive(feeds)
153
154 if err := status.Err(); err != nil {
155 return nil, err
156 }
157 return c.toGo(), nil
158}
159
160// PartialRun enables incremental evaluation of graphs.
161//

Callers 15

ExampleFunction · 0.95
makeTensorFromImageFunction · 0.95
TestGraphAddGradientsFunction · 0.95
TestSessionRunNegFunction · 0.95
TestSessionRunConcatFunction · 0.95
TestConcurrencyFunction · 0.95
TestSessionConfigFunction · 0.95
TestShapeAttributeFunction · 0.95
TestDatasetFunction · 0.95

Calls 13

newCRunArgsFunction · 0.85
newStatusFunction · 0.85
ptrOutputFunction · 0.85
ptrTensorFunction · 0.85
ptrOperationFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80
KeepAliveMethod · 0.80
toGoMethod · 0.80
NewMethod · 0.45
AddMethod · 0.45
DoneMethod · 0.45

Tested by 15

ExampleFunction · 0.76
makeTensorFromImageFunction · 0.76
TestGraphAddGradientsFunction · 0.76
TestSessionRunNegFunction · 0.76
TestSessionRunConcatFunction · 0.76
TestConcurrencyFunction · 0.76
TestSessionConfigFunction · 0.76
TestShapeAttributeFunction · 0.76
TestDatasetFunction · 0.76