Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::ops::AsString
#include <string_ops.h>
Converts each entry in the given tensor to strings.
Summary
Supports many numeric types and boolean.
For Unicode, see the [https://www.tensorflow.org/tutorials/representation/unicode](Working with Unicode text) tutorial.
Examples:
tf.strings.as_string([3, 2]) tf.strings.as_string([3.1415926, 2.71828], precision=2).numpy() array([b'3.14', b'2.72'], dtype=object)
Args:
Optional attributes (see Attrs
):
- precision: The post-decimal precision to use for floating point numbers. Only used if precision > -1.
- scientific: Use scientific notation for floating point numbers.
- shortest: Use shortest representation (either scientific or standard) for floating point numbers.
- width: Pad pre-decimal numbers to this width. Applies to both floating point and integer numbers. Only used if width > -1.
- fill: The value to pad if width > -1. If empty, pads with spaces. Another typical value is '0'. String cannot be longer than 1 character.
Returns:
Public attributes
Public functions
node
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Public static functions
Fill
Attrs Fill(
StringPiece x
)
Precision
Attrs Precision(
int64 x
)
Scientific
Attrs Scientific(
bool x
)
Shortest
Attrs Shortest(
bool x
)
Width
Attrs Width(
int64 x
)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tensorflow::ops::AsString Class Reference\n\ntensorflow::ops::AsString\n=========================\n\n`#include \u003cstring_ops.h\u003e`\n\nConverts each entry in the given tensor to strings.\n\nSummary\n-------\n\nSupports many numeric types and boolean.\n\nFor Unicode, see the \\[\u003chttps://www.tensorflow.org/tutorials/representation/unicode\u003e\\](Working with Unicode text) tutorial.\n\nExamples:\n\ntf.strings.as_string(\\[3, 2\\]) tf.strings.as_string(\\[3.1415926, 2.71828\\], precision=2).numpy() array(\\[b'3.14', b'2.72'\\], dtype=object)\n\nArgs:\n\n- scope: A [Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/as-string/attrs#structtensorflow_1_1ops_1_1_as_string_1_1_attrs)):\n\n- precision: The post-decimal precision to use for floating point numbers. Only used if precision \\\u003e -1.\n- scientific: Use scientific notation for floating point numbers.\n- shortest: Use shortest representation (either scientific or standard) for floating point numbers.\n- width: [Pad](/versions/r2.14/api_docs/cc/class/tensorflow/ops/pad#classtensorflow_1_1ops_1_1_pad) pre-decimal numbers to this width. Applies to both floating point and integer numbers. Only used if width \\\u003e -1.\n- fill: The value to pad if width \\\u003e -1. If empty, pads with spaces. Another typical value is '0'. String cannot be longer than 1 character.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.14/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): The output tensor.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [AsString](#classtensorflow_1_1ops_1_1_as_string_1a93703cfbec4867fde47aa2259770786d)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input)` ||\n| [AsString](#classtensorflow_1_1ops_1_1_as_string_1a48e83706cffb25050240d9ae8e2d84e4)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, const `[AsString::Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/as-string/attrs#structtensorflow_1_1ops_1_1_as_string_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_as_string_1a4f40ee7fcae884138385d66946669132) | [Operation](/versions/r2.14/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_as_string_1afd5f84ceab758a320b25af91eb1614ff) | `::`[tensorflow::Output](/versions/r2.14/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|---------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_as_string_1abb163457f3457bfe14dd5192aeced5c5)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_as_string_1a25d4641309fe3d0f801105ad0b3027be)`() const ` | |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_as_string_1a0b6fa38b640976c2d6651a9a96ae9fec)`() const ` | |\n\n| ### Public static functions ||\n|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|\n| [Fill](#classtensorflow_1_1ops_1_1_as_string_1ac3d8aab67abdc6322377e5d914aa3124)`(StringPiece x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/as-string/attrs#structtensorflow_1_1ops_1_1_as_string_1_1_attrs) |\n| [Precision](#classtensorflow_1_1ops_1_1_as_string_1aa3a1688f03e1afc119452b92d96054ff)`(int64 x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/as-string/attrs#structtensorflow_1_1ops_1_1_as_string_1_1_attrs) |\n| [Scientific](#classtensorflow_1_1ops_1_1_as_string_1a258997efffeb32c7733aaeef5f6b3614)`(bool x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/as-string/attrs#structtensorflow_1_1ops_1_1_as_string_1_1_attrs) |\n| [Shortest](#classtensorflow_1_1ops_1_1_as_string_1acfa9078d608f2939a48684fbf6607558)`(bool x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/as-string/attrs#structtensorflow_1_1ops_1_1_as_string_1_1_attrs) |\n| [Width](#classtensorflow_1_1ops_1_1_as_string_1a5c6d3289fae480ee2909b51f14351bf5)`(int64 x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/as-string/attrs#structtensorflow_1_1ops_1_1_as_string_1_1_attrs) |\n\n| ### Structs ||\n|-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::AsString::Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/as-string/attrs) | Optional attribute setters for [AsString](/versions/r2.14/api_docs/cc/class/tensorflow/ops/as-string#classtensorflow_1_1ops_1_1_as_string). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### AsString\n\n```gdscript\n AsString(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input\n)\n``` \n\n### AsString\n\n```gdscript\n AsString(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n const AsString::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### Fill\n\n```text\nAttrs Fill(\n StringPiece x\n)\n``` \n\n### Precision\n\n```text\nAttrs Precision(\n int64 x\n)\n``` \n\n### Scientific\n\n```text\nAttrs Scientific(\n bool x\n)\n``` \n\n### Shortest\n\n```text\nAttrs Shortest(\n bool x\n)\n``` \n\n### Width\n\n```text\nAttrs Width(\n int64 x\n)\n```"]]