You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by cj...@apache.org on 2017/10/16 16:51:20 UTC

[incubator-mxnet] branch master updated: [CMAKE] Fix windows cmake build (#8227)

This is an automated email from the ASF dual-hosted git repository.

cjolivier01 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 1c1c788  [CMAKE] Fix windows cmake build (#8227)
1c1c788 is described below

commit 1c1c788916d672ee3cafdc4c91d7002a94a59d13
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Mon Oct 16 09:51:17 2017 -0700

    [CMAKE] Fix windows cmake build (#8227)
    
    * [CMAKE] Fix windows cmake build
    
    * Add headers, updated to potential compat with msvc 13
    
    * upgrade cpp package script
    
    * fix viz
---
 CMakeLists.txt                            | 10 +++++--
 cpp-package/scripts/OpWrapperGenerator.py | 11 +++++---
 nnvm                                      |  2 +-
 python/mxnet/visualization.py             | 44 +++++++++++++++----------------
 4 files changed, 38 insertions(+), 29 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 76ef5af..63bc8d7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -275,7 +275,14 @@ FILE(GLOB_RECURSE SOURCE "src/*.cc" "src/*.h" "include/*.h")
 FILE(GLOB_RECURSE CUDA "src/*.cu" "src/*.cuh")
 
 # add nnvm to source
-FILE(GLOB_RECURSE NNVMSOURCE "nnvm/src/*.cc" "nnvm/src/*.h" "nnvm/include/*.h")
+FILE(GLOB_RECURSE NNVMSOURCE
+  nnvm/src/c_api/*.cc
+  nnvm/src/core/*.cc
+  nnvm/src/pass/*.cc
+  nnvm/src/c_api/*.h
+  nnvm/src/core/*.h
+  nnvm/src/pass/*.h
+  nnvm/include/*.h)
 list(APPEND SOURCE ${NNVMSOURCE})
 
 # add mshadow file
@@ -527,4 +534,3 @@ if(MSVC)
 endif()
 set(LINT_DIRS include src scripts python tests cpp-package)
 add_custom_target(mxnet_lint COMMAND ${CMAKE_COMMAND} -DMSVC=${MSVC} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DLINT_DIRS=${LINT_DIRS} -DPROJECT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DPROJECT_NAME=mxnet -P ${CMAKE_CURRENT_SOURCE_DIR}/dmlc-core/cmake/lint.cmake)
-
diff --git a/cpp-package/scripts/OpWrapperGenerator.py b/cpp-package/scripts/OpWrapperGenerator.py
index 83495fe..ac95773 100644
--- a/cpp-package/scripts/OpWrapperGenerator.py
+++ b/cpp-package/scripts/OpWrapperGenerator.py
@@ -124,12 +124,15 @@ class Arg:
                 self.defaultString = self.enum.GetDefaultValueString(self.defaultString)
             elif self.defaultString == 'None':
                 self.defaultString = self.type + '()'
-            elif self.defaultString == 'False':
-                self.defaultString = 'false'
-            elif self.defaultString == 'True':
-                self.defaultString = 'true'
+            elif self.type == "bool":
+                if self.defaultString == "1" or self.defaultString == "True":
+                    self.defaultString = "true"
+                else:
+                    self.defaultString = "false"
             elif self.defaultString[0] == '(':
                 self.defaultString = 'Shape' + self.defaultString
+            elif self.defaultString[0] == '[':
+                self.defaultString = 'Shape(' + self.defaultString[1:-1] + ")"
             elif self.type == 'dmlc::optional<int>':
                 self.defaultString = self.type + '(' + self.defaultString + ')'
             elif typeString.startswith('caffe-layer-parameter'):
diff --git a/nnvm b/nnvm
index c86afa8..ef0adc8 160000
--- a/nnvm
+++ b/nnvm
@@ -1 +1 @@
-Subproject commit c86afa8f17a44bcd4e6eec41cd49ba87e4f7a635
+Subproject commit ef0adc813e8e11fad2380f46f4e0d63b451d7cbf
diff --git a/python/mxnet/visualization.py b/python/mxnet/visualization.py
index aa00488..8c4cc3b 100644
--- a/python/mxnet/visualization.py
+++ b/python/mxnet/visualization.py
@@ -134,20 +134,20 @@ def print_summary(symbol, shape=None, line_length=120, positions=[.44, .64, .74,
                             pre_filter = pre_filter + int(shape[0])
         cur_param = 0
         if op == 'Convolution':
-            if ("no_bias" in node["attr"]) and (node["attr"]["no_bias"] == 'True'):
-                cur_param = pre_filter * int(node["attr"]["num_filter"])
-                for k in _str2tuple(node["attr"]["kernel"]):
+            if ("no_bias" in node["attrs"]) and int(node["attrs"]["no_bias"]):
+                cur_param = pre_filter * int(node["attrs"]["num_filter"])
+                for k in _str2tuple(node["attrs"]["kernel"]):
                     cur_param *= int(k)
             else:
-                cur_param = pre_filter * int(node["attr"]["num_filter"])
-                for k in _str2tuple(node["attr"]["kernel"]):
+                cur_param = pre_filter * int(node["attrs"]["num_filter"])
+                for k in _str2tuple(node["attrs"]["kernel"]):
                     cur_param *= int(k)
-                cur_param += int(node["attr"]["num_filter"])
+                cur_param += int(node["attrs"]["num_filter"])
         elif op == 'FullyConnected':
-            if ("no_bias" in node["attr"]) and (node["attr"]["no_bias"] == 'True'):
-                cur_param = pre_filter * (int(node["attr"]["num_hidden"]))
+            if ("no_bias" in node["attrs"]) and int(node["attrs"]["no_bias"]):
+                cur_param = pre_filter * (int(node["attrs"]["num_hidden"]))
             else:
-                cur_param = (pre_filter+1) * (int(node["attr"]["num_hidden"]))
+                cur_param = (pre_filter+1) * (int(node["attrs"]["num_hidden"]))
         elif op == 'BatchNorm':
             key = node["name"] + "_output"
             if show_shape:
@@ -291,24 +291,24 @@ def plot_network(symbol, title="plot", save_format='pdf', shape=None, node_attrs
             label = node["name"]
             attr["fillcolor"] = cm[0]
         elif op == "Convolution":
-            label = r"Convolution\n%s/%s, %s" % ("x".join(_str2tuple(node["attr"]["kernel"])),
-                                                 "x".join(_str2tuple(node["attr"]["stride"]))
-                                                 if "stride" in node["attr"] else "1",
-                                                 node["attr"]["num_filter"])
+            label = r"Convolution\n%s/%s, %s" % ("x".join(_str2tuple(node["attrs"]["kernel"])),
+                                                 "x".join(_str2tuple(node["attrs"]["stride"]))
+                                                 if "stride" in node["attrs"] else "1",
+                                                 node["attrs"]["num_filter"])
             attr["fillcolor"] = cm[1]
         elif op == "FullyConnected":
-            label = r"FullyConnected\n%s" % node["attr"]["num_hidden"]
+            label = r"FullyConnected\n%s" % node["attrs"]["num_hidden"]
             attr["fillcolor"] = cm[1]
         elif op == "BatchNorm":
             attr["fillcolor"] = cm[3]
         elif op == "Activation" or op == "LeakyReLU":
-            label = r"%s\n%s" % (op, node["attr"]["act_type"])
+            label = r"%s\n%s" % (op, node["attrs"]["act_type"])
             attr["fillcolor"] = cm[2]
         elif op == "Pooling":
-            label = r"Pooling\n%s, %s/%s" % (node["attr"]["pool_type"],
-                                             "x".join(_str2tuple(node["attr"]["kernel"])),
-                                             "x".join(_str2tuple(node["attr"]["stride"]))
-                                             if "stride" in node["attr"] else "1")
+            label = r"Pooling\n%s, %s/%s" % (node["attrs"]["pool_type"],
+                                             "x".join(_str2tuple(node["attrs"]["kernel"])),
+                                             "x".join(_str2tuple(node["attrs"]["stride"]))
+                                             if "stride" in node["attrs"] else "1")
             attr["fillcolor"] = cm[4]
         elif op == "Concat" or op == "Flatten" or op == "Reshape":
             attr["fillcolor"] = cm[5]
@@ -317,7 +317,7 @@ def plot_network(symbol, title="plot", save_format='pdf', shape=None, node_attrs
         else:
             attr["fillcolor"] = cm[7]
             if op == "Custom":
-                label = node["attr"]["op_type"]
+                label = node["attrs"]["op_type"]
 
         dot.node(name=name, label=label, **attr)
 
@@ -338,8 +338,8 @@ def plot_network(symbol, title="plot", save_format='pdf', shape=None, node_attrs
                     if draw_shape:
                         if input_node["op"] != "null":
                             key = input_name + "_output"
-                            if "attr" in input_node:
-                                params = input_node["attr"]
+                            if "attrs" in input_node:
+                                params = input_node["attrs"]
                                 if "num_outputs" in params:
                                     key += str(int(params["num_outputs"]) - 1)
                             shape = shape_dict[key][1:]

-- 
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].