Conversion

tf.as_string(input, precision=None, scientific=None, shortest=None, width=None, fill=None, name=None)

Converts each entry in the given tensor to strings. Supports many numeric

types and boolean.

Args:
  • input: A Tensor. Must be one of the following types: int32, int64, complex64, float32, float64, bool, int8.
  • precision: An optional int. Defaults to -1. The post-decimal precision to use for floating point numbers. Only used if precision > -1.
  • scientific: An optional bool. Defaults to False. Use scientific notation for floating point numbers.
  • shortest: An optional bool. Defaults to False. Use shortest representation (either scientific or standard) for floating point numbers.
  • width: An optional int. Defaults to -1. Pad pre-decimal numbers to this width. Applies to both floating point and integer numbers. Only used if width > -1.
  • fill: An optional string. Defaults to "". The value to pad if width > -1. If empty, pads with spaces. Another typical value is '0'. String cannot be longer than 1 character.
  • name: A name for the operation (optional).
Returns:

A Tensor of type string.


tf.encode_base64(input, pad=None, name=None)

Encode strings into web-safe base64 format.

Refer to the following article for more information on base64 format: en.wikipedia.org/wiki/Base64. Base64 strings may have padding with '=' at the end so that the encoded has length multiple of 4. See Padding section of the link above.

Web-safe means that the encoder uses - and _ instead of + and /.

Args:
  • input: A Tensor of type string. Strings to be encoded.
  • pad: An optional bool. Defaults to False. Bool whether padding is applied at the ends.
  • name: A name for the operation (optional).
Returns:

A Tensor of type string. Input strings encoded in base64.


tf.decode_base64(input, name=None)

Decode web-safe base64-encoded strings.

Input may or may not have padding at the end. See EncodeBase64 for padding. Web-safe means that input must use - and _ instead of + and /.

Args:
  • input: A Tensor of type string. Base64 strings to decode.
  • name: A name for the operation (optional).
Returns:

A Tensor of type string. Decoded strings.