diff options
author | Derek Murray <mrry@google.com> | 2018-09-05 18:16:33 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-05 18:20:28 -0700 |
commit | ad5c0c4d091c93ef65e91c55cb4df065d0c7a989 (patch) | |
tree | 7a2fb348f4fab36e3b65963a7613c3ac8f8f21a4 /tensorflow/core/framework | |
parent | 7ec8114697a78271277c1b81707f53057d047901 (diff) |
[tf.data] Move all C++ code inside the `tensorflow::data` namespace.
PiperOrigin-RevId: 211733735
Diffstat (limited to 'tensorflow/core/framework')
-rw-r--r-- | tensorflow/core/framework/dataset.cc | 2 | ||||
-rw-r--r-- | tensorflow/core/framework/dataset.h | 30 | ||||
-rw-r--r-- | tensorflow/core/framework/dataset_stateful_op_whitelist.h | 11 | ||||
-rw-r--r-- | tensorflow/core/framework/stats_aggregator.h | 3 |
4 files changed, 33 insertions, 13 deletions
diff --git a/tensorflow/core/framework/dataset.cc b/tensorflow/core/framework/dataset.cc index 9ffd8e1ee0..5281c56f04 100644 --- a/tensorflow/core/framework/dataset.cc +++ b/tensorflow/core/framework/dataset.cc @@ -19,6 +19,7 @@ limitations under the License. #include "tensorflow/core/graph/node_builder.h" namespace tensorflow { +namespace data { namespace { @@ -329,4 +330,5 @@ void BackgroundWorker::WorkerLoop() { } } +} // namespace data } // namespace tensorflow diff --git a/tensorflow/core/framework/dataset.h b/tensorflow/core/framework/dataset.h index 04865a1d4f..4e51fba048 100644 --- a/tensorflow/core/framework/dataset.h +++ b/tensorflow/core/framework/dataset.h @@ -40,6 +40,13 @@ limitations under the License. namespace tensorflow { +// Forward declarations to avoid introducing a dependency on headers in +// "tensorflow/core/graph/...". +class GraphDefBuilder; +class Node; + +namespace data { + class DatasetBase; class SerializationContext; @@ -66,11 +73,6 @@ class IteratorStateWriter { virtual ~IteratorStateWriter() {} }; -// Forward declarations to avoid introducing a dependency on headers in -// "tensorflow/core/graph/...". -class GraphDefBuilder; -class Node; - // Wrapper around GraphDefBuilder. Used to serialize Dataset graph. class GraphDefBuilderWrapper { public: @@ -222,8 +224,7 @@ class GraphDefBuilderWrapper { return (str_util::EndsWith(op_def->name(), "Dataset") && op_def->output_arg_size() == 1 && op_def->output_arg(0).type() == DT_VARIANT) || - dataset::WhitelistedStatefulOpRegistry::Global()->Contains( - op_def->name()); + WhitelistedStatefulOpRegistry::Global()->Contains(op_def->name()); } bool HasAttr(const string& op_type_name, const string& attr_name) const; @@ -751,6 +752,21 @@ class BackgroundWorker { std::deque<std::function<void()>> work_queue_ GUARDED_BY(mu_); }; +} // namespace data + +// TODO(b/114112161): Remove these aliases when all users have moved over to the +// `tensorflow::data` namespace. +using data::DatasetBase; +using data::DatasetContext; +using data::DatasetIterator; +using data::DatasetOpKernel; +using data::IteratorBase; +using data::IteratorContext; +using data::IteratorStateReader; +using data::IteratorStateWriter; +using data::SerializationContext; +using data::UnaryDatasetOpKernel; + } // namespace tensorflow #endif // TENSORFLOW_CORE_FRAMEWORK_DATASET_H_ diff --git a/tensorflow/core/framework/dataset_stateful_op_whitelist.h b/tensorflow/core/framework/dataset_stateful_op_whitelist.h index 3b48999edb..21c21723d0 100644 --- a/tensorflow/core/framework/dataset_stateful_op_whitelist.h +++ b/tensorflow/core/framework/dataset_stateful_op_whitelist.h @@ -19,7 +19,7 @@ limitations under the License. #include "tensorflow/core/lib/core/status.h" namespace tensorflow { -namespace dataset { +namespace data { // Registry for stateful ops that need to be used in dataset functions. // See below macro for usage details. class WhitelistedStatefulOpRegistry { @@ -47,7 +47,7 @@ class WhitelistedStatefulOpRegistry { std::set<StringPiece> op_names_; }; -} // namespace dataset +} // namespace data // Use this macro to whitelist an op that is marked stateful but needs to be // used inside a map_fn in an input pipeline. This is only needed if you wish @@ -67,10 +67,9 @@ class WhitelistedStatefulOpRegistry { WHITELIST_STATEFUL_OP_FOR_DATASET_FUNCTIONS_UNIQ_HELPER(__COUNTER__, name) #define WHITELIST_STATEFUL_OP_FOR_DATASET_FUNCTIONS_UNIQ_HELPER(ctr, name) \ WHITELIST_STATEFUL_OP_FOR_DATASET_FUNCTIONS_UNIQ(ctr, name) -#define WHITELIST_STATEFUL_OP_FOR_DATASET_FUNCTIONS_UNIQ(ctr, name) \ - static ::tensorflow::Status whitelist_op##ctr TF_ATTRIBUTE_UNUSED = \ - ::tensorflow::dataset::WhitelistedStatefulOpRegistry::Global()->Add( \ - name) +#define WHITELIST_STATEFUL_OP_FOR_DATASET_FUNCTIONS_UNIQ(ctr, name) \ + static ::tensorflow::Status whitelist_op##ctr TF_ATTRIBUTE_UNUSED = \ + ::tensorflow::data::WhitelistedStatefulOpRegistry::Global()->Add(name) } // namespace tensorflow diff --git a/tensorflow/core/framework/stats_aggregator.h b/tensorflow/core/framework/stats_aggregator.h index 4a18efc940..af53ed0a3c 100644 --- a/tensorflow/core/framework/stats_aggregator.h +++ b/tensorflow/core/framework/stats_aggregator.h @@ -25,6 +25,8 @@ namespace tensorflow { class Summary; +namespace data { + // A `StatsAggregator` accumulates statistics incrementally. A // `StatsAggregator` can accumulate multiple different statistics, distinguished // by a string name. @@ -87,6 +89,7 @@ class StatsAggregatorResource : public ResourceBase { const std::shared_ptr<StatsAggregator> stats_aggregator_; }; +} // namespace data } // namespace tensorflow #endif // TENSORFLOW_CORE_FRAMEWORK_STATS_AGGREGATOR_H_ |