noise = torch.from_numpy( sts.laplace.rvs( loc=0, scale=0.375, size=clients_grad_dict[0][key].shape)).type( torch.float).to(torch.device("cpu")) if c < 15: noise = noise0 t = clients_grad_dict[c][key] + noise temp.append(t) if c > 14: client_average_grad_dict[key] += t / 50 t_vector.append( np.concatenate((np.array(t.view(1, -1))), axis=0)) # ''' hv[epoch] = t_vector.copy() if key == 'fc3.weight': for l in range(len(t_vector)): for n in range(epoch - 1): t_vector[l] += hv[n][l] similaritys = cosine_similarity(t_vector) print(similaritys) v = [] for i in range(Num_client): tmax = -999 for j in range(Num_client): if i != j and similaritys[i][j] > tmax: tmax = similaritys[i][j]