A single string value stored in an `StringGauge`.
| 236 | |
| 237 | |
| 238 | class StringGaugeCell(object): |
| 239 | """A single string value stored in an `StringGauge`.""" |
| 240 | |
| 241 | def __init__(self, cell): |
| 242 | """Creates a new StringGaugeCell. |
| 243 | |
| 244 | Args: |
| 245 | cell: A c pointer of TFE_MonitoringStringGaugeCell. |
| 246 | """ |
| 247 | self._cell = cell |
| 248 | |
| 249 | def set(self, value): |
| 250 | """Atomically set the value. |
| 251 | |
| 252 | Args: |
| 253 | value: string value. |
| 254 | """ |
| 255 | pywrap_tensorflow.TFE_MonitoringStringGaugeCellSet(self._cell, value) |
| 256 | |
| 257 | def value(self): |
| 258 | """Retrieves the current value.""" |
| 259 | with c_api_util.tf_buffer() as buffer_: |
| 260 | pywrap_tensorflow.TFE_MonitoringStringGaugeCellValue(self._cell, buffer_) |
| 261 | value = pywrap_tensorflow.TF_GetBuffer(buffer_).decode('utf-8') |
| 262 | return value |
| 263 | |
| 264 | |
| 265 | class StringGauge(Metric): |