jax.numpy.fromstring

Contents

jax.numpy.fromstring#

jax.numpy.fromstring(string, dtype=<class 'float'>, count=-1, *, sep)[source]#

A new 1-D array initialized from text data in a string.

LAX-backend implementation of numpy.fromstring().

Original docstring below.

Parameters:
  • string (str) – A string containing the data.

  • dtype (data-type, optional) – The data type of the array; default: float. For binary input data, the data must be in exactly this format. Most builtin numeric types are supported and extension types may be supported.

  • count (int, optional) – Read this number of dtype elements from the data. If this is negative (the default), the count will be determined from the length of the data.

  • sep (str, optional) –

    The string separating numbers in the data; extra whitespace between elements is also ignored.

    Deprecated since version 1.14: Passing sep='', the default, is deprecated since it will trigger the deprecated binary mode of this function. This mode interprets string as binary bytes, rather than ASCII text with decimal numbers, an operation which is better spelt frombuffer(string, dtype, count). If string contains unicode text, the binary mode of fromstring will first encode it into bytes using utf-8, which will not produce sane results.

Returns:

arr – The constructed array.

Return type:

ndarray