NumpyDeserializer: NumpySerializer Class

NumpyDeserializerR Documentation

NumpySerializer Class

Description

Deserialize a stream of data in the .npy or UTF-8 CSV/JSON format. This serializer class uses python numpy package to deserialize, R objects through the use of the 'reticulate' package.

Super classes

sagemaker.mlcore::BaseDeserializer -> sagemaker.mlcore::SimpleBaseDeserializer -> NumpyDeserializer

Public fields

np

Python Numpy package

dtype

The dtype of the data

allow_pickle

Allow loading pickled object arrays

Methods

Public methods

Inherited methods

Method new()

Initialize a “NumpyDeserializer“ instance.

Usage
NumpyDeserializer$new(
  dtype = NULL,
  accept = "application/x-npy",
  allow_pickle = TRUE
)
Arguments
dtype

(str): The dtype of the data (default: None).

accept

(union[str, tuple[str]]): The MIME type (or tuple of allowable MIME types) that is expected from the inference endpoint (default: "application/x-npy").

allow_pickle

(bool): Allow loading pickled object arrays (default: True).


Method deserialize()

Deserialize data from an inference endpoint into a NumPy array.

Usage
NumpyDeserializer$deserialize(stream, content_type)
Arguments
stream

(botocore.response.StreamingBody): Data to be deserialized.

content_type

(str): The MIME type of the data.

Returns

matrix: The data deserialized into a R matrix/array.


Method clone()

The objects of this class are cloneable with this method.

Usage
NumpyDeserializer$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other serializer: BaseDeserializer, BaseSerializer, BytesDeserializer, CSVDeserializer, CSVSerializer, DataTableDeserializer, IdentitySerializer, JSONDeserializer, JSONLinesDeserializer, JSONLinesSerializer, JSONSerializer, LibSVMSerializer, NumpySerializer, SimpleBaseDeserializer, SimpleBaseSerializer, SparseMatrixSerializer, StringDeserializer, TibbleDeserializer


DyfanJones/sagemaker-r-mlcore documentation built on May 3, 2022, 10:08 a.m.