class_docstr: Deserialize a stream of data in .npy, .npz or UTF-8 CSV/JSON format to a numpy array.
  
  Note that when using application/x-npz archive format, the result will usually be a
  dictionary-like object containing multiple arrays (as per ``numpy.load()``) - instead of a
  single array.
class_docstr_tok: ["Deserialize","a","stream","of","data","in",".npy",",",".npz","or","UTF-8","CSV\/JSON","format","to","a","numpy","array",".","Note","that","when","using","application\/x-npz","archive","format",",","the","result","will","usually","be","a","dictionary-like","object","containing","multiple","arrays","(","as","per","``","numpy.load","(",")","``",")","-","instead","of","a","single","array","."]
docstr: Deserialize data from an inference endpoint into a NumPy array.
  
  Args:
      stream (botocore.response.StreamingBody): Data to be deserialized.
      content_type (str): The MIME type of the data.
  
  Returns:
      numpy.ndarray: The data deserialized into a NumPy array.
docstr_tok: ["Deserialize","data","from","an","inference","endpoint","into","a","NumPy","array",".","Args",":","stream","(","botocore.response.StreamingBody",")",":","Data","to","be","deserialized",".","content_type","(","str",")",":","The","MIME","type","of","the","data",".","Returns",":","numpy.ndarray",":","The","data","deserialized","into","a","NumPy","array","."]
code: def deserialize(self, stream, content_type):
      """Deserialize data from an inference endpoint into a NumPy array.
  
      Args:
          stream (botocore.response.StreamingBody): Data to be deserialized.
          content_type (str): The MIME type of the data.
  
      Returns:
          numpy.ndarray: The data deserialized into a NumPy array.
      """
      try:
          if content_type == "text/csv":
              return np.genfromtxt(
                  codecs.getreader("utf-8")(stream),
                  delimiter=",",
                  dtype=self.dtype,
              )
          if content_type == "application/json":
              return np.array(
                  json.load(codecs.getreader("utf-8")(stream)),
                  dtype=self.dtype,
              )
          if content_type == "application/x-npy":
              return np.load(
                  io.BytesIO(stream.read()),
                  allow_pickle=self.allow_pickle,
              )
          if content_type == "application/x-npz":
              try:
                  return np.load(
                      io.BytesIO(stream.read()),
                      allow_pickle=self.allow_pickle,
                  )
              finally:
                  stream.close()
      finally:
          stream.close()
  
      raise ValueError(
          "%s cannot read content type %s."
          % (__class__.__name__, content_type)
      )
  
imports: from __future__ import absolute_import
  import csv
  import abc
  import codecs
  import io
  import json
  import numpy
  from six import with_metaclass
  from sagemaker.utils import DeferredError
label_desc: Use image node_id 2 for calling the NumpyDeserializer obj's underlying member method code with example usage: obj.deserialize(stream, content_type) and returns: np, np, np, np