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

Method _update_with_movers

tensorflow/python/client/session.py:1422–1446  ·  view source on GitHub ↗
(self, feed_dict, feed_map)

Source from the content-addressed store, hash-verified

1420 self.run(fetches, feed_dict=feeds)
1421
1422 def _update_with_movers(self, feed_dict, feed_map):
1423 # If a tensor handle that is fed to a device incompatible placeholder,
1424 # we move the tensor to the right device, generate a new tensor handle,
1425 # and update `feed_dict` to use the new handle.
1426 handle_movers = []
1427 for feed_name, val in feed_map.items():
1428 mover = session_ops._get_handle_mover(self.graph, *val)
1429 if mover:
1430 handle_movers.append((feed_name, val[1], mover))
1431 # Transfer a tensor to the right device if needed.
1432 if not handle_movers:
1433 return []
1434 else:
1435 feeds = {}
1436 fetches = []
1437 for _, handle, mover in handle_movers:
1438 feeds[mover[0]] = handle
1439 fetches.append(mover[1])
1440 handles = self.run(fetches, feed_dict=feeds)
1441 for handle_mover, handle in zip(handle_movers, handles):
1442 np_val = np.array(handle.handle, dtype=np.object)
1443 feed_name = handle_mover[0]
1444 feed_tensor = feed_map[feed_name][0]
1445 feed_dict[feed_tensor] = np_val
1446 return handles
1447
1448 def _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list,
1449 run_metadata):

Callers 1

_runMethod · 0.95

Calls 2

runMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected