示例#1
0
def test_hybrid_search(benchmark, size, dtype, device):
    nns_opt = dict(knn=1, radius=0.01)
    np_a = np.array(np.random.rand(size, 3), dtype=to_numpy_dtype(dtype))
    np_b = np.array(np.random.rand(size, 3), dtype=to_numpy_dtype(dtype))
    a = o3c.Tensor(np_a, dtype=dtype, device=device)
    b = o3c.Tensor(np_b, dtype=dtype, device=device)
    index = NNSOps.hybrid_setup(a, nns_opt)
    benchmark(NNSOps.hybrid_search, index, b, nns_opt)
示例#2
0
def test_binary_ew_ops(benchmark, size, dtype, op):
    np_a = np.array(np.random.uniform(1, 127, size),
                    dtype=to_numpy_dtype(dtype))
    np_b = np.array(np.random.uniform(1, 127, size),
                    dtype=to_numpy_dtype(dtype))
    a = o3c.Tensor(np_a, dtype=dtype, device=o3c.Device("CPU:0"))
    b = o3c.Tensor(np_b, dtype=dtype, device=o3c.Device("CPU:0"))
    benchmark(op, a, b)
示例#3
0
def test_knn_setup(benchmark, size, dim, dtype, device):
    nns_opt = dict(knn=1, radius=0.01)
    np_a = np.array(np.random.rand(size, dim), dtype=to_numpy_dtype(dtype))
    a = o3c.Tensor(np_a, dtype=dtype, device=device)
    benchmark(NNSOps.knn_setup, a, nns_opt)
示例#4
0
def test_binary_ew_ops_numpy(benchmark, size, dtype, op):
    np_a = np.array(np.random.uniform(1, 127, size),
                    dtype=to_numpy_dtype(dtype))
    np_b = np.array(np.random.uniform(1, 127, size),
                    dtype=to_numpy_dtype(dtype))
    benchmark(to_numpy_binary_op(op), np_a, np_b)
示例#5
0
def test_float_unary_ew_ops_numpy(benchmark, size, dtype, op):
    # Set upper bound to 88 to avoid overflow for exp() op.
    np_a = np.array(np.random.uniform(1, 88, size),
                    dtype=to_numpy_dtype(dtype))
    benchmark(to_numpy_unary_op(op), np_a)
示例#6
0
def test_float_unary_ew_ops(benchmark, size, dtype, op):
    # Set upper bound to 88 to avoid overflow for exp() op.
    np_a = np.array(np.random.uniform(1, 88, size),
                    dtype=to_numpy_dtype(dtype))
    a = o3c.Tensor(np_a, dtype=dtype, device=o3c.Device("CPU:0"))
    benchmark(op, a)