1 /* Copyright 2019 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 #ifndef TENSORFLOW_CORE_KERNELS_DATA_EXPERIMENTAL_PARALLEL_INTERLEAVE_DATASET_OP_H_ 16 #define TENSORFLOW_CORE_KERNELS_DATA_EXPERIMENTAL_PARALLEL_INTERLEAVE_DATASET_OP_H_ 17 18 #include "tensorflow/core/data/captured_function.h" 19 #include "tensorflow/core/data/dataset_utils.h" 20 #include "tensorflow/core/framework/dataset.h" 21 22 namespace tensorflow { 23 namespace data { 24 namespace experimental { 25 26 // See documentation in ../../ops/experimental_dataset_ops.cc for a high-level 27 // description of the following op. 28 29 class ParallelInterleaveDatasetOp : public UnaryDatasetOpKernel { 30 public: 31 static constexpr const char* const kDatasetType = "LegacyParallelInterleave"; 32 static constexpr const char* const kInputDataset = "input_dataset"; 33 static constexpr const char* const kOtherArguments = "other_arguments"; 34 static constexpr const char* const kCycleLength = "cycle_length"; 35 static constexpr const char* const kBlockLength = "block_length"; 36 static constexpr const char* const kDeterministic = "deterministic"; 37 static constexpr const char* const kSloppy = "sloppy"; 38 static constexpr const char* const kBufferOutputElements = 39 "buffer_output_elements"; 40 static constexpr const char* const kPrefetchInputElements = 41 "prefetch_input_elements"; 42 static constexpr const char* const kFunc = "f"; 43 static constexpr const char* const kTarguments = "Targuments"; 44 static constexpr const char* const kOutputTypes = "output_types"; 45 static constexpr const char* const kOutputShapes = "output_shapes"; 46 47 explicit ParallelInterleaveDatasetOp(OpKernelConstruction* ctx); 48 49 protected: 50 void MakeDataset(OpKernelContext* ctx, DatasetBase* input, 51 DatasetBase** output) override; 52 53 private: 54 class Dataset; 55 const int op_version_; 56 57 std::shared_ptr<FunctionMetadata> func_metadata_ = nullptr; 58 DataTypeVector output_types_; 59 std::vector<PartialTensorShape> output_shapes_; 60 DeterminismPolicy deterministic_; 61 }; 62 63 } // namespace experimental 64 } // namespace data 65 } // namespace tensorflow 66 67 #endif // TENSORFLOW_CORE_KERNELS_DATA_EXPERIMENTAL_PARALLEL_INTERLEAVE_DATASET_OP_H_ 68