(self, cipher_operator, optimizer, n_iter_, batch_index)
return delta_grad
Compute gradients.
        Received local_gradients from guest and hosts. Merge and optimize, then separate and remote back.
        Parameters
        ----------
        cipher_operator: Use for encryption

        optimizer: optimizer that get delta gradient of this iter

        n_iter_: int, current iter nums

        batch_index: int, use to obtain current encrypted_calculator
Compute gradients.
        Received local_gradients from guest and hosts. Merge and optimize, then separate and remote back.
        Parameters
        ----------
        cipher_operator: Use for encryption
Compute gradients . Received local_gradients from guest and hosts . Merge and optimize then separate and remote back . Parameters ---------- cipher_operator : Use for encryption
def compute_gradient_procedure(self, cipher_operator, optimizer, n_iter_, batch_index):
        """
        Compute gradients.
        Received local_gradients from guest and hosts. Merge and optimize, then separate and remote back.
        Parameters
        ----------
        cipher_operator: Use for encryption

        optimizer: optimizer that get delta gradient of this iter

        n_iter_: int, current iter nums

        batch_index: int, use to obtain current encrypted_calculator

        """
        current_suffix = (n_iter_, batch_index)

        host_gradients, guest_gradient = self.get_local_gradient(current_suffix)

        if len(host_gradients) > 1:
            self.has_multiple_hosts = True

        host_gradients = [np.array(h) for h in host_gradients]
        guest_gradient = np.array(guest_gradient)

        size_list = [h_g.shape[0] for h_g in host_gradients]
        size_list.append(guest_gradient.shape[0])

        gradient = np.hstack((h for h in host_gradients))
        gradient = np.hstack((gradient, guest_gradient))

        grad = np.array(cipher_operator.decrypt_list(gradient))

        # LOGGER.debug("In arbiter compute_gradient_procedure, before apply grad: {}, size_list: {}".format(
        #     grad, size_list
        # ))

        delta_grad = optimizer.apply_gradients(grad)

        # LOGGER.debug("In arbiter compute_gradient_procedure, delta_grad: {}".format(
        #     delta_grad
        # ))
        separate_optim_gradient = self.separate(delta_grad, size_list)
        # LOGGER.debug("In arbiter compute_gradient_procedure, separated gradient: {}".format(
        #     separate_optim_gradient
        # ))
        host_optim_gradients = separate_optim_gradient[: -1]
        guest_optim_gradient = separate_optim_gradient[-1]

        self.remote_local_gradient(host_optim_gradients, guest_optim_gradient, current_suffix)
        return delta_grad
def compute_gradient_procedure ( self , cipher_operator , optimizer , n_iter_ , batch_index ) : current_suffix = ( n_iter_ , batch_index ) host_gradients , guest_gradient = self . get_local_gradient ( current_suffix ) if len ( host_gradients ) > 1 : self . has_multiple_hosts = True host_gradients = [ np . array ( h ) for h in host_gradients ] guest_gradient = np . array ( guest_gradient ) size_list = [ h_g . shape [ 0 ] for h_g in host_gradients ] size_list . append ( guest_gradient . shape [ 0 ] ) gradient = np . hstack ( ( h for h in host_gradients ) ) gradient = np . hstack ( ( gradient , guest_gradient ) ) grad = np . array ( cipher_operator . decrypt_list ( gradient ) ) # LOGGER.debug("In arbiter compute_gradient_procedure, before apply grad: {}, size_list: {}".format( #     grad, size_list # )) delta_grad = optimizer . apply_gradients ( grad ) # LOGGER.debug("In arbiter compute_gradient_procedure, delta_grad: {}".format( #     delta_grad # )) separate_optim_gradient = self . separate ( delta_grad , size_list ) # LOGGER.debug("In arbiter compute_gradient_procedure, separated gradient: {}".format( #     separate_optim_gradient # )) host_optim_gradients = separate_optim_gradient [ : - 1 ] guest_optim_gradient = separate_optim_gradient [ - 1 ] self . remote_local_gradient ( host_optim_gradients , guest_optim_gradient , current_suffix ) return delta_grad