@@ -436,6 +436,7 @@ def forward(
436436 ##################
437437 active_log_dict = self .update_info if log_step else None
438438 o = self .tstep_encoder (obs = batch .obs , rl2s = batch .rl2s , log_dict = active_log_dict )
439+ straight_from_obs = {k : batch .obs [k ] for k in self .pass_obs_keys_to_actor }
439440
440441 ###################
441442 ## Get Organized ##
@@ -479,7 +480,7 @@ def forward(
479480 ## a ~ \pi(s) ##
480481 ################
481482 critic_loss = None
482- a_dist = self .actor (s_rep , log_dict = active_log_dict , straight_from_obs = { k : batch . obs [ k ] for k in self . pass_obs_keys_to_actor } )
483+ a_dist = self .actor (s_rep , log_dict = active_log_dict , straight_from_obs = straight_from_obs )
483484 a_agent = self ._sample_k_actions (a_dist , k = K_a )
484485 assert a_agent .shape == (K_a , B , L , G , D_action )
485486 if log_step :
@@ -501,7 +502,7 @@ def forward(
501502 ################
502503 with torch .no_grad ():
503504 # (a ~ pi_target)
504- a_prime_dist = self .target_actor (s_rep ) if self .use_target_actor else a_dist
505+ a_prime_dist = self .target_actor (s_rep , straight_from_obs = straight_from_obs ) if self .use_target_actor else a_dist
505506 ap = self ._sample_k_actions (a_prime_dist , k = K_c ).detach () # a'
506507 assert ap .shape == (K_c , B , L , G , D_action )
507508 sp_ap_gp = (s_rep [:, 1 :, ...], ap [:, :, 1 :, ...]) # (s', a')
@@ -788,6 +789,7 @@ def forward(self, batch: Batch, log_step: bool):
788789 ##################
789790 active_log_dict = self .update_info if log_step else None
790791 o = self .tstep_encoder (obs = batch .obs , rl2s = batch .rl2s , log_dict = active_log_dict )
792+ straight_from_obs = {k : batch .obs [k ] for k in self .pass_obs_keys_to_actor }
791793
792794 ###################
793795 ## Get Organized ##
@@ -823,7 +825,7 @@ def forward(self, batch: Batch, log_step: bool):
823825 ################
824826 ## a ~ \pi(s) ##
825827 ################
826- a_dist = self .actor (s_rep , log_dict = active_log_dict , straight_from_obs = { k : batch . obs [ k ] for k in self . pass_obs_keys_to_actor } )
828+ a_dist = self .actor (s_rep , log_dict = active_log_dict , straight_from_obs = straight_from_obs )
827829 if self .discrete :
828830 a_dist = DiscreteLikeContinuous (a_dist )
829831 if log_step :
@@ -837,7 +839,7 @@ def forward(self, batch: Batch, log_step: bool):
837839 ################
838840 with torch .no_grad ():
839841 if self .use_target_actor :
840- a_prime_dist = self .target_actor (s_rep )
842+ a_prime_dist = self .target_actor (s_rep , straight_from_obs = straight_from_obs )
841843 if self .discrete :
842844 a_prime_dist = DiscreteLikeContinuous (a_prime_dist )
843845 else :
0 commit comments