From c2052b2bb9086853bfb778922c5931677e077455 Mon Sep 17 00:00:00 2001
From: Neta Zmora <neta.zmora@intel.com>
Date: Fri, 25 Oct 2019 11:34:20 +0300
Subject: [PATCH] summary_graph.py: fix issue #360

Add try/except block around code accessing missing convolution
shape information.
---
 distiller/summary_graph.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/distiller/summary_graph.py b/distiller/summary_graph.py
index 5c951f9..9a74a5f 100755
--- a/distiller/summary_graph.py
+++ b/distiller/summary_graph.py
@@ -325,8 +325,15 @@ class SummaryGraph(object):
             elif op['type'] == 'Gemm':
                 conv_out = op['outputs'][0]
                 conv_in = op['inputs'][0]
-                n_ifm = self.param_shape(conv_in)[1]
-                n_ofm = self.param_shape(conv_out)[1]
+                try:
+                    n_ifm = self.param_shape(conv_in)[1]
+                    n_ofm = self.param_shape(conv_out)[1]
+                    msglogger.error("An input to a Convolutional layer is missing shape information.")
+                    msglogger.error("For details see https://github.com/NervanaSystems/distiller/issues/360")
+                except IndexError:
+                    n_ifm = 0
+                    n_ofm = 0
+
                 # MACs = #IFM * #OFM
                 op['attrs']['MACs'] = n_ofm * n_ifm
 
-- 
GitLab