• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <std_string.i>
17 %include "tensorflow/python/lib/core/strings.i"
18 %include "tensorflow/python/platform/base.i"
19 
20 %{
21 #include "tensorflow/core/lib/core/status.h"
22 #include "tensorflow/core/util/stat_summarizer.h"
23 #include "tensorflow/python/lib/core/py_func.h"
24 
25 #include "tensorflow/core/framework/step_stats.pb.h"
26 %}
27 
28 %ignoreall
29 
30 %unignore NewStatSummarizer;
31 %unignore DeleteStatSummarizer;
32 %unignore tensorflow;
33 %unignore tensorflow::StatSummarizer;
34 %unignore tensorflow::StatSummarizer::StatSummarizer;
35 %unignore tensorflow::StatSummarizer::~StatSummarizer;
36 %unignore tensorflow::StatSummarizer::Initialize;
37 %unignore tensorflow::StatSummarizer::InitializeStr;
38 %unignore tensorflow::StatSummarizer::ProcessStepStats;
39 %unignore tensorflow::StatSummarizer::ProcessStepStatsStr;
40 %unignore tensorflow::StatSummarizer::PrintStepStats;
41 %unignore tensorflow::StatSummarizer::GetOutputString;
42 
43 
44 // TODO(ashankar): Remove the unused argument from the API.
45 %{
NewStatSummarizer(const string & unused)46 tensorflow::StatSummarizer* NewStatSummarizer(
47       const string& unused) {
48   return new tensorflow::StatSummarizer(tensorflow::StatSummarizerOptions());
49 }
50 %}
51 
52 %{
DeleteStatSummarizer(tensorflow::StatSummarizer * ss)53 void DeleteStatSummarizer(tensorflow::StatSummarizer* ss) {
54   delete ss;
55 }
56 %}
57 
58 tensorflow::StatSummarizer* NewStatSummarizer(const string& unused);
59 void DeleteStatSummarizer(tensorflow::StatSummarizer* ss);
60 
61 %extend tensorflow::StatSummarizer {
ProcessStepStatsStr(const string & step_stats_str)62   void ProcessStepStatsStr(const string& step_stats_str) {
63     tensorflow::StepStats step_stats;
64     step_stats.ParseFromString(step_stats_str);
65     $self->ProcessStepStats(step_stats);
66 }
67 }
68 
69 %extend tensorflow::StatSummarizer {
StatSummarizer()70   StatSummarizer() {
71     tensorflow::StatSummarizer* ss = new tensorflow::StatSummarizer(
72       tensorflow::StatSummarizerOptions());
73     return ss;
74 }
75 }
76 %include "tensorflow/core/util/stat_summarizer_options.h"
77 %include "tensorflow/core/util/stat_summarizer.h"
78 %unignoreall
79