import numpy as np

def sigmoid(Z):
    """
    Compute the sigmoid activation function.

    Args:
        Z (numpy.ndarray): The input array.

    Returns:
        numpy.ndarray: An array with the same shape as Z, containing the sigmoid activation values.

    Example:
        ```python
        Z = np.array([[-1, 0], [1, 2]])
        A = sigmoid(Z)
        print(A)
        ```
    """
    return 1 / (1 + np.exp(-Z))
