code: def get_mock_hybrid_loss(actor_net, action_spec):
      def hybrid_loss(experience, training=False):
          del training
          batch_size = (
              tf.compat.dimension_value(experience.step_type.shape[0])
              or tf.shape(experience.step_type)[0]
          )
          network_state = actor_net.get_initial_state(batch_size)
          # actor may define random ops like cropping. Pass training=False to disable.
          bc_output, _ = actor_net(
              experience.observation,
              step_type=experience.step_type,
              training=False,
              network_state=network_state,
          )
  
          def _compute_loss(dist, label, spec):
              prediction = dist.mean()
              if spec.dtype.is_integer:
                  cross_entropy = (
                      tf.keras.losses.CategoricalCrossentropy(
                          reduction=tf.keras.losses.Reduction.NONE
                      )
                  )
                  return cross_entropy(label, prediction)
              else:
                  return tf.reduce_sum(
                      tf.math.squared_difference(label, prediction),
                      axis=-1,
                  )
  
          losses_dict = tf.nest.map_structure(
              _compute_loss, bc_output, experience.action, action_spec
          )
          return tf.add_n(tf.nest.flatten(losses_dict))
  
      return hybrid_loss
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  import tensorflow
  import tensorflow_probability
  from tf_agents.agents import test_util
  from tf_agents.agents.behavioral_cloning import behavioral_cloning_agent
  from tf_agents.keras_layers import inner_reshape
  from tf_agents.networks import expand_dims_layer
  from tf_agents.networks import q_network
  from tf_agents.networks import q_rnn_network
  from tf_agents.networks import sequential
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import time_step
  from tf_agents.trajectories import trajectory
  from tf_agents.utils import common
  from tf_agents.utils import test_utils
label_desc: Use image node_id 3 for calling a global function with example usage: get_mock_hybrid_loss(actor_net, action_spec) and returns: hybrid_loss, tf, cross_entropy, tf