def make_optimize_tensor(self, model, session=None, var_list=None, **kwargs):
        """
        Make Tensorflow optimization tensor.
        This method builds optimization tensor and initializes all necessary variables
        created by optimizer.

            :param model: GPflow model.
            :param session: Tensorflow session.
            :param var_list: List of variables for training.
            :param kwargs: Dictionary of extra parameters passed to Tensorflow
                optimizer's minimize method.
            :return: Tensorflow optimization tensor or operation.
        """
        session = model.enquire_session(session)
        objective = model.objective
        full_var_list = self._gen_var_list(model, var_list)
        # Create optimizer variables before initialization.
        with session.as_default():
            minimize = self.optimizer.minimize(objective, var_list=full_var_list, **kwargs)
            model.initialize(session=session)
            self._initialize_optimizer(session)
            return minimize
def make_optimize_tensor ( self , model , session = None , var_list = None , ** kwargs ) : session = model . enquire_session ( session ) objective = model . objective full_var_list = self . _gen_var_list ( model , var_list ) with session . as_default ( ) : minimize = self . optimizer . minimize ( objective , var_list = full_var_list , ** kwargs ) model . initialize ( session = session ) self . _initialize_optimizer ( session ) return minimize
Make Tensorflow optimization tensor.
        This method builds optimization tensor and initializes all necessary variables
        created by optimizer.

            :param model: GPflow model.
            :param session: Tensorflow session.
            :param var_list: List of variables for training.
            :param kwargs: Dictionary of extra parameters passed to Tensorflow
                optimizer's minimize method.
            :return: Tensorflow optimization tensor or operation.