Skip to content

Commit

Permalink
Add Engine.generate_random_inputs() (#966)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoin committed Mar 21, 2023
1 parent 326f513 commit a8079c0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/deepsparse/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
from tqdm.auto import tqdm

from deepsparse.benchmark import BenchmarkResults
from deepsparse.utils import model_to_path, override_onnx_input_shapes
from deepsparse.utils import (
generate_random_inputs,
model_to_path,
override_onnx_input_shapes,
)


try:
Expand Down Expand Up @@ -314,6 +318,13 @@ def cpu_vnni(self) -> bool:
"""
return self._cpu_vnni

def generate_random_inputs(self) -> List[numpy.ndarray]:
"""
Generate random data that matches the type and shape of the ONNX model
:return: List of random tensors
"""
return generate_random_inputs(self.model_path, self.batch_size)

def run(
self,
inp: List[numpy.ndarray],
Expand Down

0 comments on commit a8079c0

Please sign in to comment.