mirror of
https://github.com/wassname/ray.git
synced 2026-07-09 09:42:27 +08:00
Vendored
+2
-3
@@ -145,7 +145,7 @@ def tril(a):
|
||||
result.objrefs[i, j] = single.zeros_like(a.objrefs[i, j])
|
||||
return result
|
||||
|
||||
@halo.remote([np.ndarray, None], [np.ndarray])
|
||||
@halo.remote([np.ndarray], [np.ndarray])
|
||||
def blockwise_dot(*matrices):
|
||||
n = len(matrices)
|
||||
if n % 2 != 0:
|
||||
@@ -171,8 +171,7 @@ def dot(a, b):
|
||||
result.objrefs[i, j] = blockwise_dot(*args)
|
||||
return result
|
||||
|
||||
# This is not in numpy, should we expose this?
|
||||
@halo.remote([DistArray, List[int], None], [DistArray])
|
||||
@halo.remote([DistArray, List[int]], [DistArray])
|
||||
def subblocks(a, *ranges):
|
||||
"""
|
||||
This function produces a distributed array from a subset of the blocks in the `a`. The result and `a` will have the same number of dimensions.For example,
|
||||
|
||||
@@ -26,18 +26,15 @@ def eye(N, M=-1, k=0, dtype_name="float"):
|
||||
def dot(a, b):
|
||||
return np.dot(a, b)
|
||||
|
||||
# TODO(rkn): My preferred signature would have been
|
||||
# @halo.remote([List[np.ndarray]], [np.ndarray]) but that currently doesn't
|
||||
# work because that would expect a list of ndarrays not a list of ObjRefs
|
||||
@halo.remote([np.ndarray, None], [np.ndarray])
|
||||
@halo.remote([np.ndarray], [np.ndarray])
|
||||
def vstack(*xs):
|
||||
return np.vstack(xs)
|
||||
|
||||
@halo.remote([np.ndarray, None], [np.ndarray])
|
||||
@halo.remote([np.ndarray], [np.ndarray])
|
||||
def hstack(*xs):
|
||||
return np.hstack(xs)
|
||||
|
||||
# TODO(rkn): this doesn't parallel the numpy API, but we can't really slice an ObjRef, think about this
|
||||
# TODO(rkn): instead of this, consider implementing slicing
|
||||
@halo.remote([np.ndarray, List[int], List[int]], [np.ndarray])
|
||||
def subarray(a, lower_indices, upper_indices): # TODO(rkn): be consistent about using "index" versus "indices"
|
||||
return a[[slice(l, u) for (l, u) in zip(lower_indices, upper_indices)]]
|
||||
@@ -71,7 +68,7 @@ def add(x1, x2):
|
||||
def subtract(x1, x2):
|
||||
return np.subtract(x1, x2)
|
||||
|
||||
@halo.remote([int, np.ndarray, None], [np.ndarray])
|
||||
@halo.remote([int, np.ndarray], [np.ndarray])
|
||||
def sum(axis, *xs):
|
||||
return np.sum(xs, axis=axis)
|
||||
|
||||
|
||||
@@ -83,6 +83,6 @@ def cond(x):
|
||||
def matrix_rank(M):
|
||||
return np.linalg.matrix_rank(M)
|
||||
|
||||
@halo.remote([np.ndarray, None], [np.ndarray])
|
||||
def multi_dot(a):
|
||||
@halo.remote([np.ndarray], [np.ndarray])
|
||||
def multi_dot(*a):
|
||||
raise NotImplementedError
|
||||
|
||||
Reference in New Issue
Block a user