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

Method take

tensorflow/python/ops/work_queue.py:360–399  ·  view source on GitHub ↗

Take work from the work queue.

(self)

Source from the content-addressed store, hash-verified

358 lambda: create_with_prompt)
359
360 def take(self):
361 """Take work from the work queue."""
362 def remote_take():
363 """Take work from remote worker."""
364 with ops.name_scope(self.name):
365 with ops.device(self._remote_device):
366 taken = gen_work_queue_ops.work_queue_take(
367 self._handle,
368 num_clients=self.num_clients)
369
370 work_bak = control_flow_ops.no_op()
371 if self._local_work_mgr:
372 work_bak = gen_work_queue_ops.save_local_work(
373 taken,
374 job_name=self._local_work_mgr.job_name,
375 task_index=self._local_work_mgr.task_index,
376 restore_works_dir=self._local_work_mgr.restore_works_dir)
377 with ops.control_dependencies([work_bak]):
378 with ops.device(self._local_device):
379 local_work = array_ops.identity(taken)
380 return local_work
381
382 def local_take():
383 """Take work from local worker."""
384 assert self._local_work_mgr, 'local_work_mgr should not be None.'
385 return self._local_work_mgr.take()
386
387 if self._local_work_mgr:
388 with ops.name_scope(self.name):
389 with ops.device(self._local_device):
390 with ops.device('/cpu:0'):
391 local_workqueue_empty = self._local_work_mgr.local_workqueue_empty()
392 local_work = control_flow_ops.cond(
393 local_workqueue_empty, remote_take, local_take)
394 else:
395 local_work = remote_take()
396
397 if self._prefix is None:
398 return local_work
399 return string_ops.string_join([self._prefix, local_work])
400
401 def input_producer(self):
402 """Returns a FIFOQueue as input producer.

Callers 15

input_producerMethod · 0.95
_train_test_splitFunction · 0.45
loss_augmented_fitMethod · 0.45
local_takeMethod · 0.45
scale_per_sliceMethod · 0.45
scale_per_sliceMethod · 0.45
fnMethod · 0.45
testRectangularBatchMethod · 0.45
testScalar2DMethod · 0.45
testSimpleTwoD32Method · 0.45

Calls 4

local_workqueue_emptyMethod · 0.80
name_scopeMethod · 0.45
deviceMethod · 0.45
condMethod · 0.45

Tested by 12

loss_augmented_fitMethod · 0.36
scale_per_sliceMethod · 0.36
scale_per_sliceMethod · 0.36
fnMethod · 0.36
testRectangularBatchMethod · 0.36
testScalar2DMethod · 0.36
testSimpleTwoD32Method · 0.36
testHigherRankMethod · 0.36
removeMethod · 0.36