enp.normalize_bytes2str

enp.normalize_bytes2str#

etils.enp.normalize_bytes2str(x: bytes) str[source]#
etils.enp.normalize_bytes2str(x: etils.enp.numpy_utils._T) etils.enp.numpy_utils._T

Normalize bytes array to str (UTF-8).

Example of usage:

for ex in tfds.as_numpy(ds):  # tf.data returns `tf.string` as `bytes`
  ex = tf.nest.map_structure(enp.normalize_bytes2str, ex)
Parameters:

x – Any array

Returns:

bytes array are decoded as str

Return type:

x