Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mypy errors in maths/gaussian_error_linear_unit.py #8610

Merged
merged 12 commits into from
Aug 16, 2023
10 changes: 4 additions & 6 deletions maths/gaussian_error_linear_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import numpy as np


def sigmoid(vector: np.array) -> np.array:
def sigmoid(vector: np.ndarray) -> np.ndarray:
"""
Mathematical function sigmoid takes a vector x of K real numbers as input and
returns 1/ (1 + e^-x).
Expand All @@ -25,17 +25,15 @@ def sigmoid(vector: np.array) -> np.array:
return 1 / (1 + np.exp(-vector))


def gaussian_error_linear_unit(vector: np.array) -> np.array:
def gaussian_error_linear_unit(vector: np.ndarray) -> np.ndarray:
"""
Implements the Gaussian Error Linear Unit (GELU) function

Parameters:
vector (np.array): A numpy array of shape (1,n)
consisting of real values
vector (np.ndarray): A numpy array of shape (1, n) consisting of real values

Returns:
gelu_vec (np.array): The input numpy array, after applying
gelu.
gelu_vec (np.ndarray): The input numpy array, after applying gelu

Examples:
>>> gaussian_error_linear_unit(np.array([-1.0, 1.0, 2.0]))
Expand Down