Skip to content

Commit

Permalink
Merge pull request #46 from amansrivastava17/ashutoshsingh0223-patch-1
Browse files Browse the repository at this point in the history
Add dummy axis argument
  • Loading branch information
amansrivastava17 authored May 5, 2020
2 parents 7c15c08 + 5541386 commit 63c752d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/embedding_as_service/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,16 @@ def download_from_url(url: str, download_path: str) -> None:
sys.stdout.write('\n')


def reduce_mean_max(vectors: np.ndarray):
def reduce_mean_max(vectors: np.ndarray, axis=None):
return np.hstack(np.mean(vectors, 0), np.max(vectors, 0))


def np_first(vectors: np.ndarray):
return np.array(vectors)[0]
def np_first(vectors: np.ndarray, axis=None):
return np.array(vectors)[:, 0, :]


def np_last(vectors: np.ndarray):
return np.array(vectors)[-1]
def np_last(vectors: np.ndarray, axis=None):
return np.array(vectors)[:, -1, :]


POOL_FUNC_MAP = {
Expand Down Expand Up @@ -162,4 +162,4 @@ def __call__(cls, *args, **kwargs):
argset = frozenset(sorted(argdict.items()))
if argset not in cls._instanceDict:
cls._instanceDict[argset] = super(ArgSingleton, cls).__call__(*args, **kwargs)
return cls._instanceDict[argset]
return cls._instanceDict[argset]

0 comments on commit 63c752d

Please sign in to comment.