code: def randomize_pb_ndarray(
      shape: tuple[int, ...],
      protocol_version: str = LATEST_PROTOCOL_VERSION,
  ) -> pb.NDArray:
      pb, _ = import_generated_stubs(protocol_version)
      arr: NDArray[np.float32] = t.cast(
          "NDArray[np.float32]", np.random.rand(*shape)
      )
      return pb.NDArray(
          shape=list(shape),
          dtype=pb.NDArray.DTYPE_FLOAT,
          float_values=arr.ravel(),
      )
  
file_path: BentoML/grpc-client/bentoml/testing/grpc/__init__.py
imports: from __future__ import annotations
  import importlib
  import traceback
  import typing
  from contextlib import ExitStack
  from contextlib import asynccontextmanager
  from typing import TYPE_CHECKING
  from ..._internal.utils import LazyLoader
  from ..._internal.utils import cached_contextmanager
  from ..._internal.utils import reserve_free_port
  from ...exceptions import BentoMLException
  from ...grpc.utils import LATEST_PROTOCOL_VERSION
  from ...grpc.utils import import_generated_stubs
  from ...grpc.utils import import_grpc
label_desc: Use image node_id 2 for calling a global function with example usage: randomize_pb_ndarray(shape, protocol_version) and returns: pb