import torch


def conj(x):
    """
    Computes the complex conjugate of complex-valued input tensor (x).
    i.e. conj(a + ib) = a - ib
    """
    assert x.size(-1) == 2

    real = x[..., 0]
    imag = x[..., 1]

    return torch.stack((real, -1.0 * imag), dim=-1)