Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
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"))