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