• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #ifndef TENSORFLOW_CORE_KERNELS_DATA_PREFETCH_DATASET_OP_H_
17 #define TENSORFLOW_CORE_KERNELS_DATA_PREFETCH_DATASET_OP_H_
18 
19 #include "tensorflow/core/framework/dataset.h"
20 #include "tensorflow/core/kernels/data/prefetch_autotuner.h"
21 
22 namespace tensorflow {
23 namespace data {
24 
25 class PrefetchDatasetOp : public UnaryDatasetOpKernel {
26  public:
27   static constexpr const char* const kDatasetType = "Prefetch";
28   static constexpr const char* const kInputDataset = "input_dataset";
29   static constexpr const char* const kBufferSize = "buffer_size";
30   static constexpr const char* const kOutputTypes = "output_types";
31   static constexpr const char* const kOutputShapes = "output_shapes";
32   static constexpr const char* const kSlackPeriod = "slack_period";
33   static constexpr const char* const kLegacyAutotune = "legacy_autotune";
34   static constexpr const char* const kBufferSizeMin = "buffer_size_min";
35 
36   explicit PrefetchDatasetOp(OpKernelConstruction* ctx);
37 
38  protected:
39   void MakeDataset(OpKernelContext* ctx, DatasetBase* input,
40                    DatasetBase** output) override;
41 
42  private:
43   class Dataset;
44   int64_t slack_period_ = 0;
45   bool legacy_autotune_ = true;
46   int64_t buffer_size_min_ = 0;
47 };
48 
49 }  // namespace data
50 }  // namespace tensorflow
51 
52 #endif  // TENSORFLOW_CORE_KERNELS_DATA_PREFETCH_DATASET_OP_H_
53