threadpool_dataset_op.cc
imports tensorflow/core/platform/cpu_info.himports tensorflow/core/platform/stringprintf.h
SHA-2569f5b46329e29449d53dd83ba90cc9792a8f03f78bf73d4263b7493374af619bb
MaleculeH(Cm)Md(In₃)
Evidence
1/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is …
11:42… IND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14==============================================================================*/
15#include "tensorflow/core/kernels/data/experimental/threadpool_dataset_op.h"
16
17#include <cstdint>
18#include <functional>
19#include <memory>
20#include <string>
21#include <utility>
22#include <vector>
23
24#include "absl/log/check.h"
25#include "absl/status/status.h"
26#include "absl/strings/str_cat.h"
27#include "tensorflow/core/data/dataset_utils.h"
28#include "tensorflow/core/framework/dataset.h"
29#include "tensorflow/core/framework/dataset_options.pb.h"
30#include "tensorflow/core/framework/op_kernel.h"
31#include "tensorflow/core/framework/resource_mgr.h"
32#include "tensorflow/core/lib/core/refcount.h"
33#include "tensorflow/core/lib/core/threadpool.h"
34#include "tensorflow/core/platform/cpu_info.h"
35#include "tensorflow/core/platform/stringprintf.h"
36#include "tensorflow/core/platform/thread_annotations.h"
37#include "tensorflow/core/util/work_sharder.h"
38
39namespace tensorflow {
⋯4 lines
78:27… e(std::move(fn));
79 } else {
80 thread_pool_.Schedule(std::bind(
81 [this](std::function<void()> bound_fn) {
82 // TODO(mrry): Consider moving this thread-local configuration …
100:4… Creates a handle to a ThreadPool resource. Note that we don't use
101// ResourceOpKernel here because the ThreadPoolResource constructor requires
102// ac …
127:17… ok()) {
128 // Do nothing; the resource can have been deleted by session resets.
129 }
130 }
131 }
132
133 void Compute(OpKernelContext* ctx) overrid …