Run resumes execution of the graph to compute the requested fetches and targets with the provided feeds.
(feeds map[Output]*Tensor, fetches []Output, targets []*Operation)
| 180 | // Run resumes execution of the graph to compute the requested fetches and |
| 181 | // targets with the provided feeds. |
| 182 | func (pr *PartialRun) Run(feeds map[Output]*Tensor, fetches []Output, targets []*Operation) ([]*Tensor, error) { |
| 183 | var ( |
| 184 | c = newCRunArgs(feeds, fetches, targets) |
| 185 | status = newStatus() |
| 186 | s = pr.session |
| 187 | ) |
| 188 | s.mu.Lock() |
| 189 | if s.c == nil { |
| 190 | s.mu.Unlock() |
| 191 | return nil, errors.New("session is closed") |
| 192 | } |
| 193 | s.wg.Add(1) |
| 194 | s.mu.Unlock() |
| 195 | defer s.wg.Done() |
| 196 | |
| 197 | C.TF_SessionPRun(s.c, pr.handle, |
| 198 | ptrOutput(c.feeds), ptrTensor(c.feedTensors), C.int(len(feeds)), |
| 199 | ptrOutput(c.fetches), ptrTensor(c.fetchTensors), C.int(len(fetches)), |
| 200 | ptrOperation(c.targets), C.int(len(targets)), |
| 201 | status.c) |
| 202 | if err := status.Err(); err != nil { |
| 203 | return nil, err |
| 204 | } |
| 205 | return c.toGo(), nil |
| 206 | } |
| 207 | |
| 208 | // NewPartialRun sets up the graph for incremental evaluation. |
| 209 | // |