Skip to content

Commit dd19238

Browse files
committed
Fix GPU test
1 parent a847b1f commit dd19238

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

tests/flow/tests_onnx.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -554,15 +554,11 @@ def test_onnx_use_custom_allocator_with_GPU(env):
554554
env.assertEqual(int(ai_memory_config["ai_onnxruntime_memory_access_num"]), 5)
555555

556556
# Make sure that allocator is not used for running and freeing the GPU model.
557-
sample_filename = os.path.join(test_data_path, 'one.raw')
558-
with open(sample_filename, 'rb') as f:
559-
sample_raw = f.read()
560-
con.execute_command('AI.TENSORSET', 'a{1}', 'FLOAT', 1, 1, 28, 28, 'BLOB', sample_raw)
557+
con.execute_command('AI.TENSORSET', 'a{1}', 'FLOAT', 3, 2, 'VALUES', 1.0, 2.0, 3.0, 4.0, 5.0, 6.0)
561558
con.execute_command('AI.MODELRUN', 'm_gpu{1}', 'INPUTS', 'a{1}', 'OUTPUTS', 'b{1}')
562559
values = con.execute_command('AI.TENSORGET', 'b{1}', 'VALUES')
563-
argmax = max(range(len(values)), key=lambda i: values[i])
564-
env.assertEqual(argmax, 1)
565-
con.execute_command('AI.MODELDEL', 'm{1}')
560+
env.assertEqual(values, [b'1', b'4', b'9', b'16', b'25', b'36'])
561+
con.execute_command('AI.MODELDEL', 'm_gpu{1}')
566562
env.assertFalse(con.execute_command('EXISTS', 'm_gpu{1}'))
567563
ai_memory_config = {k.split(":")[0]: k.split(":")[1]
568564
for k in con.execute_command("INFO MODULES").decode().split("#")[4].split()[1:]}

0 commit comments

Comments
 (0)