How to add "prev_n_obs" to input_dict?

Hi, I customized a model which is inherited from “distributional_q_tf_model”. I want to get the “prev_n_obs” by setting view_requirements just as in “ray/trajectory_view_utilizing_models.py at a2a1c46c83ba4eb924142503a82df7d2bd01dff0 · ray-project/ray · GitHub”. But when I use “obs = input_dict[“prev_n_obs”]” in forward function, it return KeyError and “prev_n_obs” are not in input_dict. Does anyone knows how to solve it ? Thanks !

1 Like

In this code here, ray/trajectory_view_utilizing_models.py at master · ray-project/ray · GitHub, the key prev_n_obs is set with view requirements in the __init__ method. Make sure you are inheriting the model properly so that the __init__ method is called.

1 Like