Repository: systemml
Updated Branches:
  refs/heads/master 0ba165cdd -> 9c3057a34


[SYSTEMML-445] Support newer as well as older Keras API


Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/9c3057a3
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/9c3057a3
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/9c3057a3

Branch: refs/heads/master
Commit: 9c3057a34c84d5bf1c698ad0a5c3c34d90412dbb
Parents: 0ba165c
Author: Niketan Pansare <[email protected]>
Authored: Tue Jan 30 16:45:55 2018 -0800
Committer: Niketan Pansare <[email protected]>
Committed: Tue Jan 30 16:45:55 2018 -0800

----------------------------------------------------------------------
 src/main/python/systemml/mllearn/keras2caffe.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/9c3057a3/src/main/python/systemml/mllearn/keras2caffe.py
----------------------------------------------------------------------
diff --git a/src/main/python/systemml/mllearn/keras2caffe.py 
b/src/main/python/systemml/mllearn/keras2caffe.py
index 81fb63a..89ec5e4 100755
--- a/src/main/python/systemml/mllearn/keras2caffe.py
+++ b/src/main/python/systemml/mllearn/keras2caffe.py
@@ -71,7 +71,9 @@ supportedLayers = {
 
 def _getInboundLayers(layer):
     in_names = []
-    for node in layer.inbound_nodes:  # get inbound nodes to current layer
+    # get inbound nodes to current layer (support newer as well as older APIs)
+    inbound_nodes = layer.inbound_nodes if hasattr(layer, 'inbound_nodes') 
else layer._inbound_nodes
+    for node in inbound_nodes:
         node_list = node.inbound_layers  # get layers pointing to this node
         in_names = in_names + node_list
     if any('flat' in s.name for s in in_names):  # For Caffe2DML to reroute 
any use of Flatten layers

Reply via email to