dfo.py
def collect_rewards(self, expl_directions):
        """
        Governs the reward function evaluations. 

        :param expl_directions: The noise vector added to theta to create candidates theta +- sigma*expl_direction
        :return torch.DoubleTensor: the collected rewards
        """
        
        # generates the candidates; this is specific to the gradient estimator used
        candidates = self.grad_estimator.get_theta_candidates(self.theta, self.sigma, expl_directions)
        
        # parallel execution of the function evaluations
        if self.parallel_func_evals:                                        
            with concurrent.futures.ThreadPoolExecutor(max_workers=self.num_workers) as executor:                                                            
                futures = {executor.submit(self.get_reward, candidate): i for i, candidate in enumerate(candidates)}                                          
                rewards = [0.0] * len(candidates)              
                for f in concurrent.futures.as_completed(futures):    
                    rewards[futures[f]] = f.result()                                                 
        else:                                                                  
            rewards = [self.get_reward(candidate) for candidate in candidates]                                                                                
        
        return torch.DoubleTensor(rewards).cuda() if self.use_cuda else torch.DoubleTensor(rewards)

        Governs the reward function evaluations. 

        :param expl_directions: The noise vector added to theta to create candidates theta +- sigma*expl_direction
        :return torch.DoubleTensor: the collected rewards
        
Governs the reward function evaluations.
Governs the reward function evaluations .
def collect_rewards(self, expl_directions):
        candidates = self.grad_estimator.get_theta_candidates(self.theta, self.sigma, expl_directions)
        if self.parallel_func_evals:                                        
            with concurrent.futures.ThreadPoolExecutor(max_workers=self.num_workers) as executor:                                                            
                futures = {executor.submit(self.get_reward, candidate): i for i, candidate in enumerate(candidates)}                                          
                rewards = [0.0] * len(candidates)              
                for f in concurrent.futures.as_completed(futures):    
                    rewards[futures[f]] = f.result()                                                 
        else:                                                                  
            rewards = [self.get_reward(candidate) for candidate in candidates]                                                                                
        return torch.DoubleTensor(rewards).cuda() if self.use_cuda else torch.DoubleTensor(rewards)
def collect_rewards ( self , expl_directions ) : candidates = self . grad_estimator . get_theta_candidates ( self . theta , self . sigma , expl_directions ) if self . parallel_func_evals : with concurrent . futures . ThreadPoolExecutor ( max_workers = self . num_workers ) as executor : futures = { executor . submit ( self . get_reward , candidate ) : i for i , candidate in enumerate ( candidates ) } rewards = [ 0.0 ] * len ( candidates ) for f in concurrent . futures . as_completed ( futures ) : rewards [ futures [ f ] ] = f . result ( ) else : rewards = [ self . get_reward ( candidate ) for candidate in candidates ] return torch . DoubleTensor ( rewards ) . cuda ( ) if self . use_cuda else torch . DoubleTensor ( rewards )
Governs the reward function evaluations.
Governs the reward function evaluations .
"""
        Governs the reward function evaluations. 

        :param expl_directions: The noise vector added to theta to create candidates theta +- sigma*expl_direction
        :return torch.DoubleTensor: the collected rewards
        """ # generates the candidates; this is specific to the gradient estimator used # parallel execution of the function evaluations
the collected rewards
the collected rewards
torch.DoubleTensor
self
expl_directions
The noise vector added to theta to create candidates theta +- sigma*expl_direction
The noise vector added to theta to create candidates theta + - sigma * expl_direction