class_docstr: :obj:`NumpyNdarray` defines API specification for the inputs/outputs of a Service, where
  either inputs will be converted to or outputs will be converted from type
  :code:`numpy.ndarray` as specified in your API function signature.
  
  A sample service implementation:
  
  .. code-block:: python
     :caption: `service.py`
  
     from __future__ import annotations
  
     from typing import TYPE_CHECKING, Any
  
     import bentoml
     from bentoml.io import NumpyNdarray
  
     if TYPE_CHECKING:
         from numpy.typing import NDArray
  
     runner = bentoml.sklearn.get("sklearn_model_clf").to_runner()
  
     svc = bentoml.Service("iris-classifier", runners=[runner])
  
     @svc.api(input=NumpyNdarray(), output=NumpyNdarray())
     def predict(input_arr: NDArray[Any]) -> NDArray[Any]:
         return runner.run(input_arr)
  
  Users then can then serve this service with :code:`bentoml serve`:
  
  .. code-block:: bash
  
      % bentoml serve ./service.py:svc --reload
  
  Users can then send requests to the newly started services with any client:
  
  .. tab-set::
  
      .. tab-item:: Bash
  
          .. code-block:: bash
  
              % curl -X POST -H "Content-Type: application/json" \
                      --data '[[5,4,3,2]]' http://0.0.0.0:3000/predict
  
              # [1]%
  
      .. tab-item:: Python
  
          .. code-block:: python
             :caption: `request.py`
  
              import requests
  
              requests.post(
                  "http://0.0.0.0:3000/predict",
                  headers={"content-type": "application/json"},
                  data='[{"0":5,"1":4,"2":3,"3":2}]'
              ).text
  
  Args:
      dtype: Data type users wish to convert their inputs/outputs to. Refer to `arrays dtypes <https://numpy.org/doc/stable/reference/arrays.dtypes.html>`_ for more information.
      enforce_dtype: Whether to enforce a certain data type. if :code:`enforce_dtype=True` then :code:`dtype` must be specified.
      shape: Given shape that an array will be converted to. For example:
  
             .. code-block:: python
                :caption: `service.py`
  
                from bentoml.io import NumpyNdarray
  
                @svc.api(input=NumpyNdarray(shape=(2,2), enforce_shape=False), output=NumpyNdarray())
                async def predict(input_array: np.ndarray) -> np.ndarray:
                    # input_array will be reshaped to (2,2)
                    result = await runner.run(input_array)
  
             When ``enforce_shape=True`` is provided, BentoML will raise an exception if the input array received does not match the `shape` provided.
  
             .. dropdown:: About the behaviour of ``shape``
                :icon: triangle-down
  
                If specified, then both :meth:`bentoml.io.NumpyNdarray.from_http_request` and :meth:`bentoml.io.NumpyNdarray.from_proto`
                will reshape the input array before sending it to the API function.
      enforce_shape: Whether to enforce a certain shape. If ``enforce_shape=True`` then ``shape`` must be specified.
  
  Returns:
      :obj:`~bentoml._internal.io_descriptors.IODescriptor`: IO Descriptor that represents a :code:`np.ndarray`.
class_docstr_tok: [":","obj",":","`","NumpyNdarray","`","defines","API","specification","for","the","inputs\/outputs","of","a","Service",",","where","either","inputs","will","be","converted","to","or","outputs","will","be","converted","from","type",":","code",":","`","numpy.ndarray","`","as","specified","in","your","API","function","signature",".","A","sample","service","implementation",":","..","code-block",":",":","python",":","caption",":","`","service.py","`","from","__future__","import","annotations","from","typing","import","TYPE_CHECKING",",","Any","import","bentoml","from","bentoml.io","import","NumpyNdarray","if","TYPE_CHECKING",":","from","numpy.typing","import","NDArray","runner","=","bentoml.sklearn.get","(","``","sklearn_model_clf","''",")",".to_runner","(",")","svc","=","bentoml.Service","(","``","iris-classifier","''",",","runners=","[","runner","]",")","@","svc.api","(","input=NumpyNdarray","(",")",",","output=NumpyNdarray","(",")",")","def","predict","(","input_arr",":","NDArray","[","Any","]",")","-",">","NDArray","[","Any","]",":","return","runner.run","(","input_arr",")","Users","then","can","then","serve","this","service","with",":","code",":","`","bentoml","serve","`",":","..","code-block",":",":","bash","%","bentoml","serve",".\/service.py",":","svc","--","reload","Users","can","then","send","requests","to","the","newly","started","services","with","any","client",":","..","tab-set",":",":","..","tab-item",":",":","Bash","..","code-block",":",":","bash","%","curl","-X","POST","-H","``","Content-Type",":","application\/json","''","\\","--","data","'","[","[","5,4,3,2","]","]","'","http",":","\/\/0.0.0.0:3000\/predict","#","[","1","]","%","..","tab-item",":",":","Python","..","code-block",":",":","python",":","caption",":","`","request.py","`","import","requests","requests.post","(","``","http",":","\/\/0.0.0.0:3000\/predict","''",",","headers=","{","``","content-type","''",":","``","application\/json","''","}",",","data=","'","[","{","``","0","''",":5",",","''","1","''",":4",",","''","2","''",":3",",","''","3","''",":2","}","]","'",")",".text","Args",":","dtype",":","Data","type","users","wish","to","convert","their","inputs\/outputs","to",".","Refer","to","`","arrays","dtypes","<","https",":","\/\/numpy.org\/doc\/stable\/reference\/arrays.dtypes.html",">","`","_","for","more","information",".","enforce_dtype",":","Whether","to","enforce","a","certain","data","type",".","if",":","code",":","`","enforce_dtype=True","`","then",":","code",":","`","dtype","`","must","be","specified",".","shape",":","Given","shape","that","an","array","will","be","converted","to",".","For","example",":","..","code-block",":",":","python",":","caption",":","`","service.py","`","from","bentoml.io","import","NumpyNdarray","@","svc.api","(","input=NumpyNdarray","(","shape=","(","2,2",")",",","enforce_shape=False",")",",","output=NumpyNdarray","(",")",")","async","def","predict","(","input_array",":","np.ndarray",")","-",">","np.ndarray",":","#","input_array","will","be","reshaped","to","(","2,2",")","result","=","await","runner.run","(","input_array",")","When","``","enforce_shape=True","``","is","provided",",","BentoML","will","raise","an","exception","if","the","input","array","received","does","not","match","the","`","shape","`","provided",".","..","dropdown",":",":","About","the","behaviour","of","``","shape","``",":","icon",":","triangle-down","If","specified",",","then","both",":","meth",":","`","bentoml.io.NumpyNdarray.from_http_request","`","and",":","meth",":","`","bentoml.io.NumpyNdarray.from_proto","`","will","reshape","the","input","array","before","sending","it","to","the","API","function",".","enforce_shape",":","Whether","to","enforce","a","certain","shape",".","If","``","enforce_shape=True","``","then","``","shape","``","must","be","specified",".","Returns",":",":","obj",":","`","~bentoml._internal.io_descriptors.IODescriptor","`",":","IO","Descriptor","that","represents","a",":","code",":","`","np.ndarray","`","."]
code: def openapi_components(self) -> dict[str, t.Any] | None:
      pass
  
imports: from __future__ import annotations
  import json
  import logging
  import typing
  from functools import lru_cache
  from starlette.requests import Request
  from starlette.responses import Response
  from ...exceptions import BadInput
  from ...exceptions import InvalidArgument
  from ...exceptions import UnprocessableEntity
  from ...grpc.utils import LATEST_PROTOCOL_VERSION
  from ...grpc.utils import import_generated_stubs
  from ..service.openapi import SUCCESS_DESCRIPTION
  from ..service.openapi.specification import MediaType
  from ..service.openapi.specification import Schema
  from ..types import LazyType
  from ..utils import LazyLoader
  from ..utils.http import set_cookies
  from .base import IODescriptor
label_desc: Use image node_id 7 for calling the NumpyNdarray obj's underlying member method code with example usage: obj.openapi_components() without return types