From 8a6b6efe651113cc3e8eb13cb13059724948bc9d Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Fri, 21 Feb 2020 22:20:15 +0100 Subject: [PATCH] Update. --- dummy.net | 8 ++++++++ sizer.py | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 dummy.net create mode 100755 sizer.py diff --git a/dummy.net b/dummy.net new file mode 100644 index 0000000..31e3a1e --- /dev/null +++ b/dummy.net @@ -0,0 +1,8 @@ +(17, 3, 60, 80) +nn.Conv2d(3, 32, 3, padding = 1) +nn.MaxPool2d(2) +nn.Conv2d(32, 32, 3, padding = 1) +nn.MaxPool2d(2) +nn.Conv2d(32, 64, 3, padding = 1) +nn.MaxPool2d(5) +nn.Conv2d(64, 128, (3, 4)) diff --git a/sizer.py b/sizer.py new file mode 100755 index 0000000..52620e8 --- /dev/null +++ b/sizer.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +import os, stat, sys +import time +import torch +from torch import nn + +t = 0 + +while True: + pt = t + t = os.stat(sys.argv[1])[stat.ST_MTIME] + if t > pt: + pt = t + os.system('clear') + try: + temp = [l.strip('\n\r') for l in open(sys.argv[1], 'r').readlines()] + x = torch.zeros(eval(temp.pop(0))) + print('-> ' + str(tuple(x.size()))) + for k in temp: + print(' ' + k) + x = eval(k + '(x)') + print('-> ' + str(tuple(x.size()))) + except: + print('** Error **') + time.sleep(1) -- 2.39.5