1 /* Copyright 2022 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_DATA_SERVICE_CLIENT_COMMON_H_ 16 #define TENSORFLOW_CORE_DATA_SERVICE_CLIENT_COMMON_H_ 17 18 #include <cstdint> 19 #include <optional> 20 #include <string> 21 #include <vector> 22 23 #include "tensorflow/core/data/service/common.pb.h" 24 #include "tensorflow/core/framework/tensor.h" 25 #include "tensorflow/core/protobuf/data_service.pb.h" 26 27 namespace tensorflow { 28 namespace data { 29 30 // tf.data service parameters. 31 struct DataServiceParams final { 32 std::string dataset_id; 33 ProcessingModeDef processing_mode; 34 std::string address; 35 std::string protocol; 36 std::string data_transfer_protocol; 37 std::string job_name; 38 int64_t repetition = 0; 39 std::optional<int64_t> num_consumers; 40 std::optional<int64_t> consumer_index; 41 TargetWorkers target_workers = TargetWorkers::TARGET_WORKERS_UNSPECIFIED; 42 DataServiceMetadata metadata; 43 std::optional<CrossTrainerCacheOptions> cross_trainer_cache_options; 44 }; 45 46 // Container to hold the result of a `GetNext` call. 47 struct GetNextResult final { 48 explicit GetNextResult() = default; 49 GetNextResult(const GetNextResult&) = delete; 50 GetNextResult& operator=(const GetNextResult&) = delete; 51 52 std::vector<Tensor> tensors; 53 bool end_of_sequence = false; 54 }; 55 56 } // namespace data 57 } // namespace tensorflow 58 59 #endif // TENSORFLOW_CORE_DATA_SERVICE_CLIENT_COMMON_H_ 60