Ejemplo n.º 1
0
def test_gen_global_max():
	''' Test global maximum calculation. '''
	from planarity.reference import _elementwise_max
	rows, cols = 32, 32
	image = gen_random_image(rows, cols)
	image2 = gen_random_image(rows, cols)

	args = {'in_ptr_1':0, 'in_ptr_2':block_size[0]*block_size[1]}
	test_res, _ = run_codegen_function(image, gen_global_max, block_size, args, 1, image2buffer={1:image2})
	ref_res = _elementwise_max(image, image2)

	assert ref_res == test_res
Ejemplo n.º 2
0
def test_elementwise_max():
	m1 = [
		[1, 2, 3, 4],
		[-1, 0, 2, 5],
		[4, 6, 2, 1]]
	m2 = [
		[7, 3,-9, 3],
		[-4, 2, 0, 1],
		[0, 8, 2, 7]]
	test_res = _elementwise_max(m1, m2)
	ref_res = [
		[7, 3, 3, 4],
		[-1, 2, 2, 5],
		[4, 8, 2, 7]]

	assert ref_res == test_res