code: def from_numpy(
      features: Union[np.ndarray, Dict[str, np.ndarray]],
      source: Union[str, DatasetSource] = None,
      targets: Union[np.ndarray, Dict[str, np.ndarray]] = None,
      name: Optional[str] = None,
      digest: Optional[str] = None,
  ) -> NumpyDataset:
      """
      Constructs a :py:class:`NumpyDataset <mlflow.data.numpy_dataset.NumpyDataset>` object from
      NumPy features, optional targets, and source. If the source is path like, then this will
      construct a DatasetSource object from the source path. Otherwise, the source is assumed to
      be a DatasetSource object.
  
      Args:
          features: NumPy features, represented as an np.ndarray or dictionary of named np.ndarrays.
          source: The source from which the numpy data was derived, e.g. a filesystem path, an S3 URI,
              an HTTPS URL, a delta table name with version, or spark table etc. ``source`` may be
              specified as a URI, a path-like string, or an instance of
              :py:class:`DatasetSource <mlflow.data.dataset_source.DatasetSource>`. If unspecified,
              the source is assumed to be the code location (e.g. notebook cell, script, etc.) where
              :py:func:`from_numpy <mlflow.data.from_numpy>` is being called.
          targets: Optional NumPy targets, represented as an np.ndarray or dictionary of named
              np.ndarrays.
          name: The name of the dataset. If unspecified, a name is generated.
          digest: The dataset digest (hash). If unspecified, a digest is computed automatically.
  
      .. testcode:: python
          :caption: Basic Example
  
          import mlflow
          import numpy as np
  
          x = np.random.uniform(size=[2, 5, 4])
          y = np.random.randint(2, size=[2])
          dataset = mlflow.data.from_numpy(x, targets=y)
  
      .. testcode:: python
          :caption: Dict Example
  
          import mlflow
          import numpy as np
  
          x = {
              "feature_1": np.random.uniform(size=[2, 5, 4]),
              "feature_2": np.random.uniform(size=[2, 5, 4]),
          }
          y = np.random.randint(2, size=[2])
          dataset = mlflow.data.from_numpy(x, targets=y)
      """
      from mlflow.data.code_dataset_source import CodeDatasetSource
      from mlflow.data.dataset_source_registry import (
          resolve_dataset_source,
      )
      from mlflow.tracking.context import registry
  
      if source is not None:
          if isinstance(source, DatasetSource):
              resolved_source = source
          else:
              resolved_source = resolve_dataset_source(
                  source,
              )
      else:
          context_tags = registry.resolve_tags()
          resolved_source = CodeDatasetSource(tags=context_tags)
      return NumpyDataset(
          features=features,
          source=resolved_source,
          targets=targets,
          name=name,
          digest=digest,
      )
  
imports: import json
  import logging
  from functools import cached_property
  from typing import Any, Dict, Optional, Union
  import numpy
  from mlflow.data.dataset import Dataset
  from mlflow.data.dataset_source import DatasetSource
  from mlflow.data.digest_utils import compute_numpy_digest
  from mlflow.data.pyfunc_dataset_mixin import PyFuncConvertibleDatasetMixin, PyFuncInputsOutputs
  from mlflow.data.schema import TensorDatasetSchema
  from mlflow.models.evaluation.base import EvaluationDataset
  from mlflow.types.utils import _infer_schema
  from mlflow.utils.annotations import experimental
label_desc: Use image node_id 1 for calling a global function with example usage: from_numpy(features, source, targets, name, digest) and returns: NumpyDataset