Skip to content

Commit

Permalink
Merge pull request #5 from f0uriest/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
f0uriest committed Jul 14, 2021
2 parents 75ccbee + 9e349fa commit 653745a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 1 addition & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
keras2c
#######

|Build-Status| |Codecov| |Codacy|
|Build-Status| |Codecov|

|License| |DOI|

Expand Down Expand Up @@ -89,9 +89,6 @@ The project is licensed under the MIT license.
.. |Codecov| image:: https://codecov.io/gh/f0uriest/keras2c/branch/master/graph/badge.svg
:target: https://codecov.io/gh/f0uriest/keras2c
:alt: Code Coverage
.. |Codacy| image:: https://api.codacy.com/project/badge/Grade/ac0b3f7d65a64a1f987463a81d2e1596
:target: https://www.codacy.com/app/f0uriest/keras2c?utm_source=github.com&utm_medium=referral&utm_content=f0uriest/keras2c&utm_campaign=Badge_Grade
:alt: Code Quality
.. |License| image:: https://img.shields.io/badge/License-MIT-blue.svg
:target: https://github.com/f0uriest/keras2c/blob/master/LICENSE
:alt: License: MIT
Expand Down
4 changes: 3 additions & 1 deletion keras2c/keras2c_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ def model2c(model, function_name, malloc=False, verbose=True):
header.write(term_sig + '; \n')
if stateful:
header.write(reset_sig + '; \n')
if not subprocess.run(['astyle', '--version']).returncode:
try:
subprocess.run(['astyle', '-n', function_name + '.h'])
subprocess.run(['astyle', '-n', function_name + '.c'])
except FileNotFoundError:
print("astyle not found, {} and {} will not be auto-formatted".format(function_name + ".h", function_name + ".c"))

return malloc_vars.keys(), stateful

Expand Down
4 changes: 3 additions & 1 deletion keras2c/make_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,7 @@ def make_test_suite(model, function_name, malloc_vars, num_tests=10, stateful=Fa
return x;}\n\n"""
file.write(s)
file.close()
if not subprocess.run(['astyle', '--version']).returncode:
try:
subprocess.run(['astyle', '-n', function_name + '_test_suite.c'])
except FileNotFoundError:
print("astyle not found, {} will not be auto-formatted".format(function_name + "_test_suite.c"))

0 comments on commit 653745a

Please sign in to comment.