def flip_spin(i, samples):
    """Flip the i-th spin configuration in `samples`.

    :param i: The i-th spin.
    :type i: int
    :param samples: A batch of samples.
                    Must be using the :math:`\\sigma_i = 0, 1` convention.
    :type samples: torch.Tensor
    """
    samples[..., i].sub_(1).abs_()
    return samples
