Home | History | Annotate | Download | only in kernels
      1 /* Copyright 2017 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_SUMMARY_INTERFACE_H_
     16 #define TENSORFLOW_CORE_KERNELS_SUMMARY_INTERFACE_H_
     17 
     18 #include <memory>
     19 
     20 #include "tensorflow/core/framework/graph.pb.h"
     21 #include "tensorflow/core/framework/resource_mgr.h"
     22 #include "tensorflow/core/lib/core/status.h"
     23 #include "tensorflow/core/platform/types.h"
     24 #include "tensorflow/core/util/event.pb.h"
     25 
     26 namespace tensorflow {
     27 
     28 // Main interface for the summary writer resource.
     29 class SummaryWriterInterface : public ResourceBase {
     30  public:
     31   virtual ~SummaryWriterInterface() override {}
     32 
     33   // Flushes all unwritten messages in the queue.
     34   virtual Status Flush() = 0;
     35 
     36   // These are called in the OpKernel::Compute methods for the summary ops.
     37   virtual Status WriteTensor(int64 global_step, Tensor t, const string& tag,
     38                              const string& serialized_metadata) = 0;
     39 
     40   virtual Status WriteScalar(int64 global_step, Tensor t,
     41                              const string& tag) = 0;
     42 
     43   virtual Status WriteHistogram(int64 global_step, Tensor t,
     44                                 const string& tag) = 0;
     45 
     46   virtual Status WriteImage(int64 global_step, Tensor t, const string& tag,
     47                             int max_images, Tensor bad_color) = 0;
     48 
     49   virtual Status WriteAudio(int64 global_step, Tensor t, const string& tag,
     50                             int max_outputs_, float sample_rate) = 0;
     51 
     52   virtual Status WriteGraph(int64 global_step,
     53                             std::unique_ptr<GraphDef> graph) = 0;
     54 
     55   virtual Status WriteEvent(std::unique_ptr<Event> e) = 0;
     56 };
     57 
     58 }  // namespace tensorflow
     59 
     60 #endif  // TENSORFLOW_CORE_KERNELS_SUMMARY_INTERFACE_H_
     61