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

Method Create

tensorflow/core/kernels/batching_util/basic_batch_scheduler.h:214–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212
213template <typename TaskType>
214Status BasicBatchScheduler<TaskType>::Create(
215 const Options& options,
216 std::function<void(std::unique_ptr<Batch<TaskType>>)>
217 process_batch_callback,
218 std::unique_ptr<BasicBatchScheduler>* scheduler) {
219 typename SharedBatchScheduler<TaskType>::Options shared_scheduler_options;
220 shared_scheduler_options.thread_pool_name = options.thread_pool_name;
221 shared_scheduler_options.num_batch_threads = options.num_batch_threads;
222 shared_scheduler_options.env = options.env;
223 std::shared_ptr<SharedBatchScheduler<TaskType>> shared_scheduler;
224 TF_RETURN_IF_ERROR(SharedBatchScheduler<TaskType>::Create(
225 shared_scheduler_options, &shared_scheduler));
226
227 typename SharedBatchScheduler<TaskType>::QueueOptions
228 shared_scheduler_queue_options;
229 shared_scheduler_queue_options.max_batch_size = options.max_batch_size;
230 shared_scheduler_queue_options.batch_timeout_micros =
231 options.batch_timeout_micros;
232 shared_scheduler_queue_options.max_enqueued_batches =
233 options.max_enqueued_batches;
234 std::unique_ptr<BatchScheduler<TaskType>> shared_scheduler_queue;
235 TF_RETURN_IF_ERROR(shared_scheduler->AddQueue(shared_scheduler_queue_options,
236 process_batch_callback,
237 &shared_scheduler_queue));
238
239 scheduler->reset(
240 new BasicBatchScheduler<TaskType>(std::move(shared_scheduler_queue)));
241 return Status::OK();
242}
243
244template <typename TaskType>
245Status BasicBatchScheduler<TaskType>::Schedule(

Callers

nothing calls this directly

Calls 3

CreateFunction · 0.50
AddQueueMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected