Put a `tf.Summary`.
(self, summary)
| 138 | func(m) |
| 139 | |
| 140 | def put_summary(self, summary): |
| 141 | """ |
| 142 | Put a `tf.Summary`. |
| 143 | """ |
| 144 | if isinstance(summary, six.binary_type): |
| 145 | summary = tf.Summary.FromString(summary) |
| 146 | assert isinstance(summary, tf.Summary), type(summary) |
| 147 | |
| 148 | # TODO other types |
| 149 | for val in summary.value: |
| 150 | if val.WhichOneof('value') == 'simple_value': |
| 151 | val.tag = re.sub('tower[0-9]+/', '', val.tag) # TODO move to subclasses |
| 152 | |
| 153 | # TODO This hack is still needed, seem to disappear only when |
| 154 | # compiled from source. |
| 155 | suffix = '-summary' # tensorflow#6150, tensorboard#59 |
| 156 | if val.tag.endswith(suffix): |
| 157 | val.tag = val.tag[:-len(suffix)] |
| 158 | |
| 159 | self._dispatch(lambda m: m.process_scalar(val.tag, val.simple_value)) |
| 160 | |
| 161 | self._dispatch(lambda m: m.process_summary(summary)) |
| 162 | |
| 163 | def put_scalar(self, name, val): |
| 164 | """ |
no test coverage detected