code: def log_model(
      model,
      artifact_path,
      custom_objects=None,
      conda_env=None,
      code_paths=None,
      signature: ModelSignature = None,
      input_example: ModelInputExample = None,
      registered_model_name=None,
      await_registration_for=DEFAULT_AWAIT_MAX_SLEEP_SECONDS,
      pip_requirements=None,
      extra_pip_requirements=None,
      saved_model_kwargs=None,
      keras_model_kwargs=None,
      metadata=None,
  ):
      """
      Log a TF2 core model (inheriting tf.Module) or a Keras model in MLflow Model format.
  
      .. note::
  
          If you log a Keras or TensorFlow model without a signature, inference with
          :py:func:`mlflow.pyfunc.spark_udf()` will not work unless the model's pyfunc
          representation accepts pandas DataFrames as inference inputs.
  
          You can infer a model's signature by calling the :py:func:`mlflow.models.infer_signature()`
          API on features from the model's test dataset. You can also manually create a model
          signature, for example:
  
          .. code-block:: python
              :caption: Example of creating signature for saving TensorFlow and `tf.Keras` models
  
              from mlflow.types.schema import Schema, TensorSpec
              from mlflow.models import ModelSignature
              import numpy as np
  
              input_schema = Schema(
                  [
                      TensorSpec(np.dtype(np.uint64), (-1, 5), "field1"),
                      TensorSpec(np.dtype(np.float32), (-1, 3, 2), "field2"),
                  ]
              )
              # Create the signature for a model that requires 2 inputs:
              #  - Input with name "field1", shape (-1, 5), type "np.uint64"
              #  - Input with name "field2", shape (-1, 3, 2), type "np.float32"
              signature = ModelSignature(inputs=input_schema)
  
      Args:
          model: The TF2 core model (inheriting tf.Module) or Keras model to be saved.
          artifact_path: The run-relative path to which to log model artifacts.
          custom_objects: A Keras ``custom_objects`` dictionary mapping names (strings) to
              custom classes or functions associated with the Keras model. MLflow saves
              these custom layers using CloudPickle and restores them automatically
              when the model is loaded with :py:func:`mlflow.tensorflow.load_model` and
              :py:func:`mlflow.pyfunc.load_model`.
          conda_env: {{ conda_env }}
          code_paths: A list of local filesystem paths to Python file dependencies (or directories
              containing file dependencies). These files are *prepended* to the system
              path when the model is loaded.
          registered_model_name: If given, create a model version under
              ``registered_model_name``, also creating a registered model if one
              with the given name does not exist.
          signature: {{ signature }}
          input_example: {{ input_example }}
          await_registration_for: Number of seconds to wait for the model version to finish
              being created and is in ``READY`` status. By default, the function
              waits for five minutes. Specify 0 or None to skip waiting.
          pip_requirements: {{ pip_requirements }}
          extra_pip_requirements: {{ extra_pip_requirements }}
          saved_model_kwargs: a dict of kwargs to pass to ``tensorflow.saved_model.save`` method.
          keras_model_kwargs: a dict of kwargs to pass to ``keras_model.save`` method.
          metadata: Custom metadata dictionary passed to the model and stored in the MLmodel file.
  
                          .. Note:: Experimental: This parameter may change or be removed in a future
                                                  release without warning.
  
      Returns
          A :py:class:`ModelInfo <mlflow.models.model.ModelInfo>` instance that contains the
          metadata of the logged model.
      """
  
      return Model.log(
          artifact_path=artifact_path,
          flavor=mlflow.tensorflow,
          model=model,
          conda_env=conda_env,
          code_paths=code_paths,
          custom_objects=custom_objects,
          registered_model_name=registered_model_name,
          signature=signature,
          input_example=input_example,
          await_registration_for=await_registration_for,
          pip_requirements=pip_requirements,
          extra_pip_requirements=extra_pip_requirements,
          saved_model_kwargs=saved_model_kwargs,
          keras_model_kwargs=keras_model_kwargs,
          metadata=metadata,
      )
  
imports: import atexit
  import importlib
  import logging
  import os
  import shutil
  import tempfile
  import warnings
  from typing import Any, Dict, NamedTuple, Optional
  import numpy
  import pandas
  import yaml
  from packaging.version import Version
  import mlflow
  from mlflow import pyfunc
  from mlflow.data.code_dataset_source import CodeDatasetSource
  from mlflow.data.numpy_dataset import from_numpy
  from mlflow.data.tensorflow_dataset import from_tensorflow
  from mlflow.exceptions import INVALID_PARAMETER_VALUE, MlflowException
  from mlflow.models import Model, ModelInputExample, ModelSignature, infer_signature
  from mlflow.models.model import MLMODEL_FILE_NAME
  from mlflow.models.signature import _infer_signature_from_input_example
  from mlflow.models.utils import _save_example
  from mlflow.tensorflow.callback import MLflowCallback
  from mlflow.tracking._model_registry import DEFAULT_AWAIT_MAX_SLEEP_SECONDS
  from mlflow.tracking.artifact_utils import _download_artifact_from_uri
  from mlflow.tracking.context import registry
  from mlflow.types.schema import TensorSpec
  from mlflow.utils import is_iterator
  from mlflow.utils.autologging_utils import PatchFunction, autologging_integration, batch_metrics_logger, get_autologging_config, log_fn_args_as_params, picklable_exception_safe_function, resolve_input_example_and_signature, safe_patch
  from mlflow.utils.autologging_utils.metrics_queue import add_to_metrics_queue, flush_metrics_queue
  from mlflow.utils.docstring_utils import LOG_MODEL_PARAM_DOCS, format_docstring
  from mlflow.utils.environment import _CONDA_ENV_FILE_NAME, _CONSTRAINTS_FILE_NAME, _PYTHON_ENV_FILE_NAME, _REQUIREMENTS_FILE_NAME, _mlflow_conda_env, _process_conda_env, _process_pip_requirements, _PythonEnv, _validate_env_arguments
  from mlflow.utils.file_utils import get_total_file_size, write_to
  from mlflow.utils.model_utils import _add_code_from_conf_to_system_path, _get_flavor_configuration, _validate_and_copy_code_paths, _validate_and_prepare_target_save_path
  from mlflow.utils.requirements_utils import _get_pinned_requirement
  from mlflow.utils.time import get_current_time_millis
label_desc: Use image node_id 4 for calling a global function with example usage: log_model(model, artifact_path, custom_objects, conda_env, code_paths, signature, input_example, registered_model_name, await_registration_for, pip_requirements, extra_pip_requirements, saved_model_kwargs, keras_model_kwargs, metadata) and returns: Model