Runs a step based on the given fetches and feeds. Args: handle: a handle for partial_run. None if this is just a call to run(). target_list: A list of operations to be run, but not fetched. fetch_list: A list of tensors to be fetched. feed_dict: A dictionary that maps te
(self, handle, target_list, fetch_list, feed_dict, options,
run_metadata)
| 1325 | r'\[\[(Node: )?(\{\{node )?([^\} ]*)(\}\})?\s*=*') |
| 1326 | |
| 1327 | def _do_run(self, handle, target_list, fetch_list, feed_dict, options, |
| 1328 | run_metadata): |
| 1329 | """Runs a step based on the given fetches and feeds. |
| 1330 | |
| 1331 | Args: |
| 1332 | handle: a handle for partial_run. None if this is just a call to run(). |
| 1333 | target_list: A list of operations to be run, but not fetched. |
| 1334 | fetch_list: A list of tensors to be fetched. |
| 1335 | feed_dict: A dictionary that maps tensors to numpy ndarrays. |
| 1336 | options: A (pointer to a) [`RunOptions`] protocol buffer, or None |
| 1337 | run_metadata: A (pointer to a) [`RunMetadata`] protocol buffer, or None |
| 1338 | |
| 1339 | Returns: |
| 1340 | A list of numpy ndarrays, corresponding to the elements of |
| 1341 | `fetch_list`. If the ith element of `fetch_list` contains the |
| 1342 | name of an operation, the first Tensor output of that operation |
| 1343 | will be returned for that element. |
| 1344 | |
| 1345 | Raises: |
| 1346 | tf.errors.OpError: Or one of its subclasses on error. |
| 1347 | """ |
| 1348 | # pylint: disable=protected-access |
| 1349 | feeds = dict((t._as_tf_output(), v) for t, v in feed_dict.items()) |
| 1350 | fetches = [t._as_tf_output() for t in fetch_list] |
| 1351 | targets = [op._c_op for op in target_list] |
| 1352 | |
| 1353 | # pylint: enable=protected-access |
| 1354 | |
| 1355 | def _run_fn(feed_dict, fetch_list, target_list, options, run_metadata): |
| 1356 | # Ensure any changes to the graph are reflected in the runtime. |
| 1357 | self._extend_graph() |
| 1358 | return self._call_tf_sessionrun(options, feed_dict, fetch_list, |
| 1359 | target_list, run_metadata) |
| 1360 | |
| 1361 | def _prun_fn(handle, feed_dict, fetch_list): |
| 1362 | if target_list: |
| 1363 | raise RuntimeError('partial_run() requires empty target_list.') |
| 1364 | return self._call_tf_sessionprun(handle, feed_dict, fetch_list) |
| 1365 | |
| 1366 | if handle is None: |
| 1367 | return self._do_call(_run_fn, feeds, fetches, targets, options, |
| 1368 | run_metadata) |
| 1369 | else: |
| 1370 | return self._do_call(_prun_fn, handle, feeds, fetches) |
| 1371 | |
| 1372 | def _do_call(self, fn, *args): |
| 1373 | try: |
no test coverage detected