Skip to content

Commit

Permalink
Merge pull request #2571 from xiezheng-XD/master
Browse files Browse the repository at this point in the history
Update Dockerfile and testResource.py
  • Loading branch information
wangzhaode authored Oct 11, 2023
2 parents 98c2f18 + 431a980 commit 1bbb3b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tools/script/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ RUN set -x; buildDeps='cmake protobuf-compiler lcov unzip zip wget git netcat py
&& echo 'deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse' > /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y $buildDeps
RUN set -x; pip install numpy tensorflow torch onnxrumtime mnist tqdm
RUN set -x; pip install numpy tensorflow torch onnxruntime mnist tqdm
17 changes: 11 additions & 6 deletions tools/script/testResource.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
#!/usr/bin/python
import sys
import os
from subprocess import Popen, PIPE, STDOUT

root_dir = sys.argv[1]
print('root: ', root_dir)

forwardType = " 0 "
if len(sys.argv) > 2:
forwardType = ' ' + sys.argv[2] + ' '

thredhold = ' 0.001 '
if len(sys.argv) > 3:
thredhold = ' ' + sys.argv[3] + ' '

import os
def run_cmd(args):
from subprocess import Popen, PIPE, STDOUT
stdout, _ = Popen(args, stdout=PIPE, stderr=STDOUT).communicate()
return stdout
process = Popen(args, stdout=PIPE, stderr=PIPE, universal_newlines=True)
stdout, stderr = process.communicate()
return stdout, stderr

for name in os.listdir(root_dir):
if name.startswith("."):
continue
modelName = os.path.join(root_dir, name, 'temp.bin')
inputName = os.path.join(root_dir, name, 'input_0.txt')
outputName = os.path.join(root_dir, name, 'output.txt')
print modelName
print(modelName)

print run_cmd(['./testModel.out', modelName, inputName, outputName, forwardType, thredhold])
stdout, stderr = run_cmd(['./testModel.out', modelName, inputName, outputName, forwardType, thredhold])
print(stdout)
if stderr:
print("Error:", stderr)

0 comments on commit 1bbb3b1

Please sign in to comment.