def join_reim(array):
    """Join the real and imaginary channels of a matrix to a single complex-valued matrix.

    Args:
      array(float): An array of shape (batch_size, N, N, 2)

    Returns:
      joined_array(complex): An complex-valued array of shape (batch_size, N, N, 1)

    """
    joined_array = array[:, :, :, 0] + 1j * array[:, :, :, 1]
    return joined_array