File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ def __exit__(self, *args):
2727
2828
2929MODEL_DIR = os .path .dirname (os .path .abspath (__file__ )) + "/testdata"
30+ TENSOR_DIR = MODEL_DIR
3031script = r"""
3132def bar(a, b):
3233 return a + b
@@ -411,11 +412,14 @@ def test_run_tflite_model(self):
411412 tflmodel = load_model (model_path )
412413 con = self .get_client ()
413414 con .modelstore ("tfl_model" , "tflite" , "cpu" , tflmodel )
414- img = np .random .random ((1 , 1 , 28 , 28 )).astype (np .float32 )
415+
416+ input_path = os .path .join (TENSOR_DIR , "one.raw" )
417+ with open (input_path , 'rb' ) as f :
418+ img = np .frombuffer (f .read (), dtype = np .float32 )
415419 con .tensorset ("img" , img )
416420 con .modelexecute ("tfl_model" , ["img" ], ["output1" , "output2" ])
417421 output = con .tensorget ("output1" )
418- self .assertTrue ( np . allclose ( output , [8 ]) )
422+ self .assertEqual ( output , [1 ] )
419423
420424 # AI.MODELRUN is deprecated by AI.MODELEXECUTE
421425 def test_deprecated_modelrun (self ):
You can’t perform that action at this time.
0 commit comments