Esempio n. 1
0
def sub(self, other):
    assert self.dtype == other.dtype and self.dtype == np.float32
    assert self.shape == other.shape

    result = Driver.empty_like(self)
    addKer(np.float32)(result, self, 1.0, other, -1.0)
    return result
Esempio n. 2
0
def addVectorToVector(x, y, out=None, alpha=1.0, beta=1.0):
    assert x.ndim == 1
    assert x.shape == y.shape
    assert x.dtype == y.dtype and x.dtype == np.float32

    if out is None:
        out = Driver.empty(queue, x.shape, dtype=np.float32, allocator=memPool)

    addKer(np.float32)(out, x, alpha, y, beta)
    return out
Esempio n. 3
0
def addMatrixToMatrix(A, B, out=None, alpha=1.0, beta=1.0):
    assert A.ndim == 2 and B.ndim == 2

    assert A.shape == B.shape
    assert A.dtype == B.dtype and A.dtype == np.float32

    if out is None:
        out = Driver.empty(queue, A.shape, dtype=np.float32, allocator=memPool)

    addKer(np.float32)(out, A, alpha, B, beta)
    return out
Esempio n. 4
0
def isub(self, other):
    assert self.dtype == other.dtype and self.dtype == np.float32
    assert self.shape == other.shape

    addKer(np.float32)(self, self, 1.0, other, -1.0)
    return self