function vec_median = vec_med(grad, v_bound)

vec_median = 0;
for i = 1:size(grad,2)
    is_median = grad(:,i);
    diff_norm = zeros(1,size(grad,2));
    diff_norm_count =1;
    for j = 1:size(grad,2)
        if j ~= i
            diff_norm(diff_norm_count) = norm(is_median-grad(:,j) );
            diff_norm_count = diff_norm_count + 1;
        end
    end
    norm_good_labels = diff_norm <= 2* v_bound;
    if (sum(norm_good_labels) > (size(grad,2)-1)/2)%(dist.get_world_size()-1)/2)
        vec_median = is_median;
        break;
    end
end