code: def core_experience(
      self, *, states, internals, auxiliaries, actions, terminal, reward
  ):
      episode_length = tf_util.cast(
          x=tf.shape(input=terminal)[0], dtype="int"
      )
      reward_discount = self.reward_discount.value()
  
      if self.reward_horizon == "episode":
          # Reward horizon is entire episode
          reward = self._terminal_experience_iterative(
              episode_length=episode_length,
              reward_discount=reward_discount,
              states=states,
              internals=internals,
              auxiliaries=auxiliaries,
              actions=actions,
              reward=reward,
              terminal=terminal,
          )
  
      else:
          # Optimize required loop iterations, so whether to process remaining timesteps
          #     - iteratively, if remaining episode length is at most reward horizon
          #     - in parallel, if reward horizon is less than remaining episode length
          reward_horizon = self.reward_horizon.value()
  
          def true_fn():
              return self._terminal_experience_iterative(
                  episode_length=episode_length,
                  reward_discount=reward_discount,
                  states=states,
                  internals=internals,
                  auxiliaries=auxiliaries,
                  actions=actions,
                  reward=reward,
                  terminal=terminal,
              )
  
          def false_fn():
              return self._terminal_experience_parallel(
                  episode_length=episode_length,
                  reward_horizon=reward_horizon,
                  reward_discount=reward_discount,
                  states=states,
                  internals=internals,
                  auxiliaries=auxiliaries,
                  actions=actions,
                  reward=reward,
                  terminal=terminal,
              )
  
          reward = tf.cond(
              pred=(episode_length <= reward_horizon),
              true_fn=true_fn,
              false_fn=false_fn,
          )
  
      # Store episode
      return self.memory.enqueue(
          states=states,
          internals=internals,
          auxiliaries=auxiliaries,
          actions=actions,
          terminal=terminal,
          reward=reward,
      )
  
imports: import logging
  import tensorflow
  from tensorforce import TensorforceError
  from tensorforce.core import ModuleDict, memory_modules, optimizer_modules, parameter_modules, SignatureDict, TensorDict, TensorSpec, TensorsSpec, tf_function, tf_util, VariableDict
  from tensorforce.core.models import Model
  from tensorforce.core.networks import Preprocessor
  from tensorforce.core.objectives import objective_modules
  from tensorforce.core.policies import policy_modules, StochasticPolicy
label_desc: Use image node_id 15 for calling the TensorforceModel obj's underlying member method code with example usage: obj.core_experience() and returns: self, self, self