def bench_pydata_ufunc_fused(tacoBench, dim):
    loader = RandomPydataSparseTensorLoader()
    matrix = safeCastPydataTensorToInts(loader.random((dim, dim), 0.01))
    matrix1 = safeCastPydataTensorToInts(loader.random((dim, dim), 0.01, variant=1))
    matrix2 = safeCastPydataTensorToInts(loader.random((dim, dim), 0.01, variant=2))
    def bench():
        result = numpy.logical_and(numpy.logical_xor(matrix, matrix1), matrix2)
        return result
    tacoBench(bench)
Пример #2
0
def bench_slice_pydata_sparse_window(tacoBench, dim, sparsity, config):
    loader = RandomPydataSparseTensorLoader()
    matrix = loader.random((dim, dim), sparsity).astype('float64')
    matrix2 = loader.random((dim, dim), sparsity, variant=1).astype('float64')

    def bench():
        x = sliceTensor(matrix, dim, config)
        x2 = sliceTensor(matrix2, dim, config)
        return (x, x2)

    tacoBench(bench)
Пример #3
0
def bench_add_pydata_sparse_index_set(tacoBench, dim, fraction):
    loader = RandomPydataSparseTensorLoader()
    indexes = [i * fraction for i in range(0, dim // fraction)]
    matrix = loader.random((dim, dim), 0.01)
    matrix2 = loader.random((dim, dim), 0.01, variant=1)

    def bench():
        x = matrix[:, indexes]
        x2 = matrix2[:, indexes]
        res = x + x2

    tacoBench(bench)
Пример #4
0
def bench_add_pydata_sparse_strided_window(tacoBench, dim, sparsity,
                                           strideWidth):
    loader = RandomPydataSparseTensorLoader()
    matrix = loader.random((dim, dim), sparsity).astype('float64')
    matrix2 = loader.random((dim, dim), sparsity, variant=1).astype('float64')

    def bench():
        x = matrix[0:dim:strideWidth, 0:dim:strideWidth]
        x2 = matrix2[0:dim:strideWidth, 0:dim:strideWidth]
        res = x + x2

    tacoBench(bench)