code: def _convert_eager_inputs(func):
      @functools.wraps(func)
      def _func(*args, **kwargs):
          if tf.executing_eagerly():
              eager_args = [_convert_to_tf(x) for x in args]
              # TODO: (sven) find a way to remove key-specific hacks.
              eager_kwargs = {
                  k: _convert_to_tf(
                      v, dtype=tf.int64 if k == "timestep" else None
                  )
                  for k, v in kwargs.items()
                  if k not in {"info_batch", "episodes"}
              }
              return func(*eager_args, **eager_kwargs)
          else:
              return func(*args, **kwargs)
  
      return _func
  
imports: import functools
  import logging
  import os
  import threading
  from typing import Dict, List, Optional, Tuple, Union
  import tree
  from ray.rllib.evaluation.episode import Episode
  from ray.rllib.models.catalog import ModelCatalog
  from ray.rllib.models.repeated_values import RepeatedValues
  from ray.rllib.policy.policy import Policy, PolicyState
  from ray.rllib.policy.rnn_sequencing import pad_batch_to_sequences_of_same_size
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.utils import add_mixins, force_list
  from ray.rllib.utils.annotations import override, DeveloperAPI
  from ray.rllib.utils.deprecation import DEPRECATED_VALUE, deprecation_warning
  from ray.rllib.utils.error import ERR_MSG_TF_POLICY_CANNOT_SAVE_KERAS_MODEL
  from ray.rllib.utils.framework import try_import_tf
  from ray.rllib.utils.metrics import DIFF_NUM_GRAD_UPDATES_VS_SAMPLER_POLICY, NUM_AGENT_STEPS_TRAINED, NUM_GRAD_UPDATES_LIFETIME
  from ray.rllib.utils.metrics.learner_info import LEARNER_STATS_KEY
  from ray.rllib.utils.numpy import convert_to_numpy
  from ray.rllib.utils.spaces.space_utils import normalize_action
  from ray.rllib.utils.tf_utils import get_gpu_devices
  from ray.rllib.utils.threading import with_lock
  from ray.rllib.utils.typing import LocalOptimizer, ModelGradients, TensorType, TensorStructType
  from ray.util.debug import log_once
label_desc: Use image node_id 3 for calling a global function with example usage: _convert_eager_inputs(func) and returns: _func, func, func