Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ def image_format(self):
"""image_format. For onnx it is always NCHW."""
return "NCHW"

def load(self, model_path, inputs=None, outputs=None):
def load(self, model_path, inputs=None, outputs=None, num_threads=None):
"""Load model and find input/outputs from the model file."""
print("************************************************************")
print(">>> Value of num_threads: ", num_threads)
print("************************************************************")
os.environ["OMP_NUM_THREADS"] = str(num_threads)
os.environ["OPENBLAS_NUM_THREADS"] = str(num_threads)
os.environ["MKL_NUM_THREADS"] = str(num_threads)
opt = rt.SessionOptions()
opt.intra_op_num_threads = int(num_threads)

# By default all optimizations are enabled
# https://onnxruntime.ai/docs/performance/graph-optimizations.html
Expand Down
4 changes: 3 additions & 1 deletion vision/classification_and_detection/python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,9 @@ def main():
model = backend.load(
args.model,
inputs=args.inputs,
outputs=args.outputs)
# outputs=args.output,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sujik18 , wasn't it originally args.outputs which is different from args.output

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right! It feels like I had unknowingly removed it and later didn't notice it

num_threads=args.threads
)
final_results = {
"runtime": model.name(),
"version": model.version(),
Expand Down
Loading