# tensorflow::ops::StringLength::Attrs Struct Reference

# tensorflow::
ops::
StringLength::
Attrs

`
#include <string_ops.h>
`


Optional attribute setters for
[StringLength](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/string-length#classtensorflow_1_1ops_1_1_string_length)
.

## Summary

| ### Public attributes ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/string-length/attrs#structtensorflow_1_1ops_1_1_string_length_1_1_attrs_1a20ddf74f682ff45eee049cef9c6ebab1 = "BYTE" ` | ` StringPiece ` |

| ### Public functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/string-length/attrs#structtensorflow_1_1ops_1_1_string_length_1_1_attrs_1ac8d16dcfea721edfcf1fe9ecd4db17d9 (StringPiece x) ` | ` TF_MUST_USE_RESULT https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/string-length/attrs#structtensorflow_1_1ops_1_1_string_length_1_1_attrs ` The unit that is counted to compute string length. |

## Public attributes

### unit_

```
StringPiece tensorflow::ops::StringLength::Attrs::unit_ = "BYTE"
```

## Public functions

### Unit

```
TF_MUST_USE_RESULT Attrs tensorflow::ops::StringLength::Attrs::Unit(
  StringPiece x
)
```

The unit that is counted to compute string length.


One of:
`
"BYTE"
`
(for the number of bytes in each string) or
`
"UTF8_CHAR"
`
(for the number of UTF-8 encoded Unicode code points in each string). Results are undefined if
`
unit=UTF8_CHAR
`
and the
`
input
`
strings do not contain structurally valid UTF-8.


Defaults to "BYTE"