mindspore.dataset.text.utils.to_bytes

mindspore.dataset.text.utils.to_bytes(array, encoding='utf8')[source]

Convert NumPy array of str to array of bytes by encoding each element based on charset encoding.

Parameters
  • array (numpy.ndarray) – Array of type str representing strings.

  • encoding (str) – Indicating the charset for encoding.

Returns

numpy.ndarray, NumPy array of bytes.