Home | History | Annotate | Download | only in common_runtime
      1 /* Copyright 2016 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 #include "tensorflow/core/common_runtime/stats_publisher_interface.h"
     17 
     18 #include "tensorflow/core/framework/graph.pb.h"
     19 
     20 namespace tensorflow {
     21 namespace {
     22 
     23 // NoOpStatsPublisher provides an dummy/no-op implementation of
     24 // StatsPublisherInterface.
     25 class NoOpStatsPublisher : public StatsPublisherInterface {
     26  public:
     27   NoOpStatsPublisher() = default;
     28 
     29   void PublishStatsProto(const StepStats& step_stats) override {}
     30 
     31   void PublishGraphProto(
     32       const std::vector<const GraphDef*>& graph_defs) override {}
     33 
     34   std::unique_ptr<ProfileHandler> GetProfileHandler(
     35       uint64 step, int64 execution_count, const RunOptions& ropts) override {
     36     return nullptr;
     37   }
     38 
     39   ~NoOpStatsPublisher() override = default;
     40 };
     41 
     42 }  // namespace
     43 
     44 std::unique_ptr<StatsPublisherInterface> CreateNoOpStatsPublisher(
     45     const string& session, const BuildGraphOptions& bopts,
     46     const SessionOptions& sopts) {
     47   return std::unique_ptr<StatsPublisherInterface>(new NoOpStatsPublisher);
     48 }
     49 
     50 }  // namespace tensorflow
     51