จากคอร์นําเข้า openvino.runtime
คอร์ = คอร์ ()
รุ่น = core.read_model (model="model.xml")
compiled_model = core.compile_model(รุ่น , "CPU")
infer_request = compiled_model.create_infer_request()
infer_request.start_async()
infer_request.wait()
เอาต์พุต = infer_request.get_output_tensor()
พิมพ์ (เอาต์พุต)
RuntimeError: ต้องเรียก get_output_tensor() บนฟังก์ชันด้วยพารามิเตอร์เดียวเท่านั้น
วิธีการ ov:InferRequest::get_output_tensor ที่ไม่มีอาร์กิวเมนต์สามารถใช้ได้สําหรับรุ่นที่มีเอาต์พุตเดียวเท่านั้น
output1 = infer_request.get_output_tensor(0)
output2 = infer_request.get_output_tensor(1)
output3 = infer_request.get_output_tensor(2)
output_buffer1 = output2.data
output_buffer2 = output2.data
output_buffer3 = output3.data
print(output_buffer1)
print(output_buffer2)
print(output_buffer3)