forked from OpenDataPlane/odp-dpdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linux-dpdk: validation: ml: add validation tests
Add validation tests for the new mldev based ML implementation. Signed-off-by: Jere Leppänen <[email protected]>
- Loading branch information
1 parent
f1d2b55
commit b963a6f
Showing
9 changed files
with
1,166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ml_dpdk | ||
conv.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
include ../Makefile.inc | ||
|
||
test_PROGRAMS = ml_dpdk | ||
ml_dpdk_SOURCES = ml_dpdk.c | ||
|
||
dist_check_SCRIPTS = ml_dpdk.sh | ||
|
||
test_SCRIPTS = $(dist_check_SCRIPTS) | ||
|
||
TESTS = $(test_SCRIPTS) | ||
|
||
EXTRA_DIST = conv_gen.py conv.onnx | ||
|
||
# If building out-of-tree, make check will not copy the scripts and data to the | ||
# $(builddir) assuming that all commands are run locally. However this prevents | ||
# running tests on a remote target using LOG_COMPILER. | ||
# So copy all script and data files explicitly here. | ||
all-local: | ||
if [ "x$(srcdir)" != "x$(builddir)" ]; then \ | ||
for f in $(EXTRA_DIST); do \ | ||
if [ -e $(srcdir)/$$f ]; then \ | ||
mkdir -p $(builddir)/$$(dirname $$f); \ | ||
cp -f $(srcdir)/$$f $(builddir)/$$f; \ | ||
fi \ | ||
done \ | ||
fi | ||
|
||
clean-local: | ||
if [ "x$(srcdir)" != "x$(builddir)" ]; then \ | ||
for f in $(EXTRA_DIST); do \ | ||
rm -f $(builddir)/$$f; \ | ||
done \ | ||
fi |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# Copyright (c) 2024 Nokia | ||
# | ||
|
||
import onnx | ||
from onnx import helper | ||
from onnx import TensorProto | ||
|
||
graph = helper.make_graph( | ||
[ # nodes | ||
helper.make_node("Conv", ["X", "W"], ["Y"], "Conv Node"), | ||
], | ||
"Test Graph", # name | ||
[ # inputs | ||
helper.make_tensor_value_info('X', TensorProto.FLOAT, [1, 1, 1, 2]), | ||
], | ||
[ # outputs | ||
helper.make_tensor_value_info('Y', TensorProto.FLOAT, [1, 1, 1, 2]), | ||
], | ||
[ # initializer | ||
helper.make_tensor('W', TensorProto.FLOAT, [1, 1, 1, 1], [2.0]), | ||
], | ||
) | ||
|
||
model = helper.make_model( | ||
graph, | ||
opset_imports=[helper.make_opsetid("", 14)], | ||
producer_name='ODP validation tests', | ||
model_version=1, | ||
doc_string="output = 2 * input", | ||
ir_version = 8 | ||
) | ||
|
||
onnx.save(model, 'conv.onnx') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh -ex | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# Copyright (c) 2024 Nokia | ||
|
||
python ./conv_gen.py | ||
mrvl-mlc conv.onnx conv --num_tiles=1 --batch=1 | ||
mv bin_conv/conv.bin . | ||
rm -rf bin_conv compiler_dir profile | ||
mlModel -M -m conv.bin |
Oops, something went wrong.