Skip to content

Commit 121f72e

Browse files
author
Robert Muchsel
committed
Do not overwrite target unless --overwrite is specified
1 parent f23957d commit 121f72e

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,7 @@ The following table describes the most important command line arguments for `ai8
11691169
| `--prefix` | Set test name prefix | `--prefix mnist` |
11701170
| `--board-name` | Set the target board (default: `EvKit_V1`) | `--board-name FTHR_RevA` |
11711171
| *Code generation* | | |
1172+
| `--overwrite` | Produce output even when the target directory exists (default: abort) | |
11721173
| `--compact-data` | Use *memcpy* to load input data in order to save code space | |
11731174
| `--compact-weights` | Use *memcpy* to load weights in order to save code space | |
11741175
| `--mexpress` | Use faster kernel loading | |
@@ -2125,3 +2126,4 @@ https://github.com/MaximIntegratedAI/MaximAI_Documentation/blob/master/CONTRIBUT
21252126

21262127
---
21272128

2129+
o

README.pdf

187 Bytes
Binary file not shown.

izer/commandline.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ def get_parser():
7070

7171
# Code generation
7272
group = parser.add_argument_group('Code generation')
73+
group.add_argument('--overwrite', action='store_true', default=False,
74+
help="overwrite destination if it exists (default: abort)")
7375
group.add_argument('--compact-data', action='store_true', default=False,
7476
help="use memcpy() to load input data in order to save code space")
7577
group.add_argument('--compact-weights', action='store_true', default=False,
@@ -253,7 +255,7 @@ def get_parser():
253255

254256
# Streaming
255257
group = parser.add_argument_group('Streaming tweaks')
256-
group.add_argument('--overlap-data', '--overwrite-ok', '--allow-overwrite',
258+
group.add_argument('--overlap-data',
257259
dest='overwrite_ok', action='store_true', default=False,
258260
help="allow output to overwrite input (default: warn/stop)")
259261
group.add_argument('--override-start', type=lambda x: int(x, 0), metavar='N',

izer/izer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ def main():
610610
snoop_sequence=snoop_sequence,
611611
simulated_sequence=simulated_sequence,
612612
debug_snoop=args.debug_snoop,
613+
overwrite=args.overwrite,
613614
)
614615
if not args.embedded_code and args.autogen.lower() != 'none':
615616
rtlsim.append_regression(

izer/max7800x.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ def create_net( # pylint: disable=too-many-arguments,too-many-locals,too-many-b
168168
snoop_sequence=None,
169169
simulated_sequence=None,
170170
debug_snoop=False,
171+
overwrite=False,
171172
):
172173
"""
173174
Chain multiple CNN layers, create and save input and output
@@ -530,7 +531,10 @@ def create_net( # pylint: disable=too-many-arguments,too-many-locals,too-many-b
530531
target_dir = os.path.join(base_directory, test_name)
531532
os.makedirs(target_dir, exist_ok=False)
532533
except OSError:
533-
wprint(target_dir, 'exists')
534+
if not overwrite:
535+
eprint('The target folder', target_dir, 'exists. Use --overwrite to proceed.')
536+
else:
537+
wprint('--overwrite specified, writing to ', target_dir, ' even though it exists.')
534538

535539
# Redirect stdout?
536540
if log:

0 commit comments

Comments
 (0)