Skip to content

Linear

Functions

linear(Z)

Compute the linear activation function.

Parameters:

Name Type Description Default
Z ndarray

The input array.

required

Returns:

Type Description

numpy.ndarray: The input array Z, unchanged.

Example
Z = np.array([[1, 2], [3, 4]])
A = linear(Z)
print(A)
Source code in microkeras/activations/linear.py
def linear(Z):
    """
    Compute the linear activation function.

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

    Returns:
        numpy.ndarray: The input array Z, unchanged.

    Example:
        ```python
        Z = np.array([[1, 2], [3, 4]])
        A = linear(Z)
        print(A)
        ```
    """
    return Z