INNER CODE UNIT · Python
replace_observation_in_time_step
GoogleCloudPlatform/vertex-ai-samples · community-content/tf_agents_bandits_movie_recommendation_with_kfp_and_vertex_sdk/mlops_pipeline_tf_agents_bandits_movie_recommendation/src/logger/main.py:78
def replace_observation_in_time_step(
original_time_step: trajectories.TimeStep,
observation: tf.Tensor) -> trajectories.TimeStep:
"""Returns a `trajectories.TimeStep` with the observation field replaced.
Args:
original_time_step: The original `trajectories.TimeStep` in which the
`observation` will be filled in.
observation: A single, batched observation.
Returns:
A `trajectories.TimeStep` with `observation` filled into
`original_time_step`.
"""
return trajectories.TimeStep(
step_type=original_time_step[0],
reward=original_time_step[1],
discount=original_time_step[2],