Skip to content

Commit 80f614c

Browse files
committed
Script for model stats
1 parent 3e5690b commit 80f614c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

model.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
from microesc import train, stats, common
3+
4+
def main():
5+
settings = common.load_experiment('experiments', 'ldcnn20k60')
6+
7+
def build():
8+
return train.sb_cnn(settings)
9+
10+
m = build()
11+
m.summary()
12+
m.save('model.wip.hdf5')
13+
14+
s = settings
15+
shape = (s['n_mels'], s['frames'], 1)
16+
model_stats = stats.analyze_model(build, [shape], n_classes=10)
17+
18+
flops, params = model_stats
19+
inference_flops = { name: v for name, v in flops.items() if not stats.is_training_scope(name) }
20+
for name, flop in inference_flops.items():
21+
print(name, flop)
22+
23+
24+
25+
if __name__ == '__main__':
26+
main()

0 commit comments

Comments
 (0)