From ee385e23e248f5fa1d2f908e59802237f368fb2f Mon Sep 17 00:00:00 2001
From: Yaman Umuroglu <maltanar@gmail.com>
Date: Mon, 21 Oct 2019 23:30:10 +0100
Subject: [PATCH] [Wrapper] add onnx save and modelproto accessors

---
 src/finn/core/modelwrapper.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/finn/core/modelwrapper.py b/src/finn/core/modelwrapper.py
index 393061219..6547c3947 100644
--- a/src/finn/core/modelwrapper.py
+++ b/src/finn/core/modelwrapper.py
@@ -33,6 +33,18 @@ class ModelWrapper:
     def graph(self, value):
         self._model_proto.graph = value
 
+    @property
+    def model(self):
+        return self._model_proto
+
+    @model.setter
+    def model(self, value):
+        self._model_proto = value
+
+    def save(self, filename):
+        """Save the wrapper ONNX ModelProto into a file with given name."""
+        onnx.save(self._model_proto, filename)
+
     def transform_repeated(self, transform):
         """Applies given transform repeatedly until no more changes can be made
         and returns a transformed ModelWrapper instance.
-- 
GitLab