Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into issue12205_4
Browse files Browse the repository at this point in the history
  • Loading branch information
szha authored Mar 5, 2019
2 parents 61a70dc + 434726e commit a3bcf9f
Show file tree
Hide file tree
Showing 470 changed files with 8,480 additions and 2,864 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/mshadow
3 changes: 2 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ List of Contributors
* [Xiao Wang](https://github.com/BeyonderXX)
* [Piyush Ghai](https://github.com/piyushghai)
* [Zach Boldyga](https://github.com/zboldyga)
* [Neo Chien](https://github.com/cchung100m)
* [Gordon Reid](https://github.com/gordon1992)
* [Ming Yang](http://ufoym.com)
* [Neo Chien](https://github.com/cchung100m)

Label Bot
---------
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ build/plugin/%_gpu.o: plugin/%.cu
$(CXX) -std=c++11 $(CFLAGS) -MM -MT build/plugin/$*_gpu.o $< >build/plugin/$*_gpu.d
$(NVCC) -c -o $@ $(NVCCFLAGS) $(CUDA_ARCH) -Xcompiler "$(CFLAGS)" $<

build/plugin/%.o: plugin/%.cc
build/plugin/%.o: plugin/%.cc | mkldnn
@mkdir -p $(@D)
$(CXX) -std=c++11 -c $(CFLAGS) -MMD -c $< -o $@

Expand Down Expand Up @@ -648,6 +648,7 @@ rclean:
ifneq ($(EXTRA_OPERATORS),)
clean: rclean cyclean $(EXTRA_PACKAGES_CLEAN)
$(RM) -r build lib bin deps *~ */*~ */*/*~ */*/*/*~
(cd scala-package && mvn clean) || true
cd $(DMLC_CORE); $(MAKE) clean; cd -
cd $(PS_PATH); $(MAKE) clean; cd -
cd $(NNVM_PATH); $(MAKE) clean; cd -
Expand All @@ -657,6 +658,7 @@ clean: rclean cyclean $(EXTRA_PACKAGES_CLEAN)
else
clean: rclean mkldnn_clean cyclean testclean $(EXTRA_PACKAGES_CLEAN)
$(RM) -r build lib bin *~ */*~ */*/*~ */*/*/*~
(cd scala-package && mvn clean) || true
cd $(DMLC_CORE); $(MAKE) clean; cd -
cd $(PS_PATH); $(MAKE) clean; cd -
cd $(NNVM_PATH); $(MAKE) clean; cd -
Expand Down
1 change: 0 additions & 1 deletion amalgamation/prep_nnvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ echo '#define MSHADOW_FORCE_STREAM
#include "mshadow/tensor.h"
#include "mxnet/base.h"
#include "dmlc/json.h"
#include "nnvm/tuple.h"
#include "mxnet/tensor_blob.h"' > temp
cat nnvm.cc >> temp
mv temp ../../../../amalgamation/nnvm.cc
2 changes: 0 additions & 2 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1033,8 +1033,6 @@ integrationtest_ubuntu_cpu_asan() {
set -ex
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5

# We do not want to fail the build on ASAN errors until memory leaks have been addressed.
export ASAN_OPTIONS=exitcode=0
cd /work/mxnet/build/cpp-package/example/
/work/mxnet/cpp-package/example/get_data.sh
./mlp_cpu
Expand Down
10 changes: 5 additions & 5 deletions ci/jenkins/Jenkinsfile_windows_cpu
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ utils.assign_node_labels(utility: 'utility', windows_cpu: 'mxnetwindows-cpu')
utils.main_wrapper(
core_logic: {
utils.parallel_stage('Build', [
custom_steps.compile_windows_cpu()
// custom_steps.compile_windows_cpu()
])

utils.parallel_stage('Tests', [
custom_steps.test_windows_python2_cpu(),
custom_steps.test_windows_python3_cpu(),
custom_steps.test_windows_julia07_cpu(),
custom_steps.test_windows_julia10_cpu()
// custom_steps.test_windows_python2_cpu(),
// custom_steps.test_windows_python3_cpu(),
// custom_steps.test_windows_julia07_cpu(),
// custom_steps.test_windows_julia10_cpu()
])
}
,
Expand Down
10 changes: 5 additions & 5 deletions ci/jenkins/Jenkinsfile_windows_gpu
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ utils.assign_node_labels(utility: 'utility', windows_cpu: 'mxnetwindows-cpu', wi
utils.main_wrapper(
core_logic: {
utils.parallel_stage('Build', [
custom_steps.compile_windows_gpu(),
custom_steps.compile_windows_gpu_mkldnn()
// custom_steps.compile_windows_gpu(),
// custom_steps.compile_windows_gpu_mkldnn()
])

utils.parallel_stage('Tests', [
custom_steps.test_windows_python2_gpu(),
custom_steps.test_windows_python3_gpu(),
custom_steps.test_windows_python3_gpu_mkldnn()
// custom_steps.test_windows_python2_gpu(),
// custom_steps.test_windows_python3_gpu(),
// custom_steps.test_windows_python3_gpu_mkldnn()
])
}
,
Expand Down
76 changes: 69 additions & 7 deletions contrib/clojure-package/src/org/apache/clojure_mxnet/image.clj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
;;

(ns org.apache.clojure-mxnet.image
"Image API of Clojure package."
(:require [t6.from-scala.core :refer [$ $$] :as $]
[org.apache.clojure-mxnet.dtype :as dtype]
[org.apache.clojure-mxnet.ndarray :as ndarray]
Expand All @@ -37,7 +38,18 @@
(s/keys :opt-un [::color-flag ::to-rgb ::output]))

(defn decode-image
"Decodes an image from an input stream"
"Decodes an image from an input stream with OpenCV
`input-stream`: `InputStream` - Contains the binary encoded image
`color-flag`: 0 or 1 - Convert decoded image to grayscale (0) or color (1)
`to-rgb`: boolean - Whether to convert decoded image to mxnet's default RGB
format (instead of opencv's default BGR)
`output`: nil or `NDArray`
returns: `NDArray` with dtype uint8
Ex:
(decode-image input-stream)
(decode-image input-stream {:color-flag 1})
(decode-image input-stream {:color-flag 0 :output nd})"
([input-stream {:keys [color-flag to-rgb output]
:or {color-flag COLOR to-rgb true output nil}
:as opts}]
Expand All @@ -54,7 +66,19 @@
(s/or :none nil? :some ::to-rgb))

(defn read-image
"Reads an image file and returns an ndarray"
"Reads an image file and returns an ndarray with OpenCV. It returns image in
RGB by default instead of OpenCV's default BGR.
`filename`: string - Name of the image file to be loaded
`color-flag`: 0 or 1 - Convert decoded image to grayscale (0) or color (1)
`to-rgb`: boolean - Whether to convert decoded image to mxnet's default RGB
format (instead of opencv's default BGR)
`output`: nil or `NDArray`
returns: `NDArray` with dtype uint8
Ex:
(read-image \"cat.jpg\")
(read-image \"cat.jpg\" {:color-flag 0})
(read-image \"cat.jpg\" {:color-flag 1 :output nd})"
([filename {:keys [color-flag to-rgb output]
:or {color-flag nil to-rgb nil output nil}
:as opts}]
Expand All @@ -74,7 +98,17 @@
(s/def ::optional-int (s/or :none nil? :some int?))

(defn resize-image
"Resizes the image array to (width, height)"
"Resizes the image array to (width, height)
`input`: `NDArray` - source image in NDArray
`w`: int - Width of resized image
`h`: int - Height of resized image
`interpolation`: Interpolation method. Default is INTER_LINEAR
`ouput`: nil or `NDArray`
returns: `NDArray`
Ex:
(resize-image nd-img 300 300)
(resize-image nd-img 28 28 {:output nd})"
([input w h {:keys [interpolation output]
:or {interpolation nil output nil}
:as opts}]
Expand All @@ -88,7 +122,21 @@
(resize-image input w h {})))

(defn apply-border
"Pad image border"
"Pad image border with OpenCV.
`input`: `NDArray` - source image in NDArray
`top`: int - Top margin
`bottom`: int - Bottom margin
`left`: int - Left margin
`right`: int - Right margin
`fill-type`: nil or Filling type - Default BORDER_CONSTANT
`value`: nil or double - Deprecated, use `values` instead
`values`: Fill with value(RGB or gray), up to 4 channels
`output`: nil or `NDArray`
returns: `NDArray`
Ex:
(apply-border img-nd 1 1 1 1)
(apply-border img-nd 3 3 0 0)"
([input top bottom left right
{:keys [fill-type value values output]
:or {fill-type nil value nil values nil output nil}
Expand All @@ -109,7 +157,17 @@
(apply-border input top bottom left right {})))

(defn fixed-crop
"Return a fixed crop of the image"
"Return a fixed crop of the image.
`input`: `NDArray` - Source image in NDArray
`x0`: int - Starting x point
`y0`: int - Starting y point
`w`: int - Width of the image
`h`: int - Height of the image
returns: cropped `NDArray`
Ex:
(fixed-crop nd-img 0 0 28 28)
(fixed-crop nd-img 10 0 100 300)"
[input x0 y0 w h]
(util/validate! ::ndarray input "Invalid input array")
(util/validate! ::int x0 "Invalid starting x coordinate")
Expand All @@ -119,7 +177,9 @@
(Image/fixedCrop input x0 y0 w h))

(defn rgb-array?
"Returns whether the ndarray is in the RGB format"
"Returns whether the ndarray is in the RGB format
`input`: `NDArray` - Source image in NDArray
returns: boolean"
[input]
(util/validate! ::ndarray input "Invalid input array")
(let [shape (ndarray/shape-vec input)]
Expand All @@ -133,7 +193,9 @@
(s/and ::ndarray ::all-bytes ::rgb-array))

(defn to-image
"Convert a NDArray image in RGB format to a real image"
"Convert a NDArray image in RGB format to a real image.
`input`: `NDArray` - Source image in NDArray
returns: `BufferedImage`"
[input]
(util/validate! ::to-image-ndarray input "Invalid input array")
(Image/toImage input))
1 change: 1 addition & 0 deletions cpp-package/example/alexnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ int main(int argc, char const *argv[]) {
}
/*don't foget to release the executor*/
delete exec;
delete opt;
MXNotifyShutdown();
return 0;
}
10 changes: 10 additions & 0 deletions cpp-package/example/charRNN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,9 @@ void train(const std::string file, int batch_size, int max_epoch, int start_epoc
std::string filepath = prefix + "-" + std::to_string(epoch) + ".params";
SaveCheckpoint(filepath, RNN, exe);
}

delete exe;
delete opt;
}

/*The original example, rnn_cell_demo.py, uses default Xavier as initalizer, which relies on
Expand Down Expand Up @@ -577,6 +580,9 @@ void trainWithBuiltInRNNOp(const std::string file, int batch_size, int max_epoch
std::string filepath = prefix + "-" + std::to_string(epoch) + ".params";
SaveCheckpoint(filepath, RNN, exe);
}

delete exe;
delete opt;
}

void predict(std::wstring* ptext, int sequence_length, const std::string param_file,
Expand Down Expand Up @@ -639,6 +645,8 @@ void predict(std::wstring* ptext, int sequence_length, const std::string param_f
next = charIndices[n];
ptext->push_back(next);
}

delete exe;
}

void predictWithBuiltInRNNOp(std::wstring* ptext, int sequence_length, const std::string param_file,
Expand Down Expand Up @@ -693,6 +701,8 @@ void predictWithBuiltInRNNOp(std::wstring* ptext, int sequence_length, const std
next = charIndices[n];
ptext->push_back(next);
}

delete exe;
}

int main(int argc, char** argv) {
Expand Down
1 change: 1 addition & 0 deletions cpp-package/example/googlenet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ int main(int argc, char const *argv[]) {
}

delete exec;
delete opt;
MXNotifyShutdown();
return 0;
}
1 change: 1 addition & 0 deletions cpp-package/example/inception_bn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ int main(int argc, char const *argv[]) {
LG << "Validation Accuracy: " << val_acc.Get();
}
delete exec;
delete opt;
MXNotifyShutdown();
return 0;
}
1 change: 1 addition & 0 deletions cpp-package/example/lenet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class Lenet {
<< ", accuracy: " << ValAccuracy(batch_size * 10, lenet);
}
delete exe;
delete opt;
}

private:
Expand Down
1 change: 1 addition & 0 deletions cpp-package/example/lenet_with_mxdataiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ int main(int argc, char const *argv[]) {
}

delete exec;
delete opt;
MXNotifyShutdown();
return 0;
}
1 change: 1 addition & 0 deletions cpp-package/example/mlp_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ int main(int argc, char** argv) {
}

delete exec;
delete opt;
MXNotifyShutdown();
return 0;
}
1 change: 1 addition & 0 deletions cpp-package/example/mlp_csv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ int main(int argc, char** argv) {
}

delete exec;
delete opt;
MXNotifyShutdown();
return 0;
}
1 change: 1 addition & 0 deletions cpp-package/example/mlp_gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ int main(int argc, char** argv) {
}

delete exec;
delete opt;
MXNotifyShutdown();
return 0;
}
1 change: 1 addition & 0 deletions cpp-package/example/resnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ int main(int argc, char const *argv[]) {
LG << "Validation Accuracy: " << val_acc.Get();
}
delete exec;
delete opt;
MXNotifyShutdown();
return 0;
}
1 change: 1 addition & 0 deletions cpp-package/example/test_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ int main(int argc, char** argv) {
opt = OptimizerRegistry::Find("adam");
int ret = (opt == 0) ? 1 : 0;

delete opt;
MXNotifyShutdown();
return ret;
}
1 change: 1 addition & 0 deletions cpp-package/example/test_score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ int main(int argc, char** argv) {
}

delete exec;
delete opt;
MXNotifyShutdown();
return score >= MIN_SCORE ? 0 : 1;
}
5 changes: 3 additions & 2 deletions docs/_static/js/options.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

/*!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Expand All @@ -18,7 +19,7 @@
*/

/* Installation page display functions for install selector */
var versionSelect = defaultVersion = 'v1.3.1';
var versionSelect = defaultVersion = 'v1.4.0';
var platformSelect = 'Linux';
var languageSelect = 'Python';
var processorSelect = 'CPU';
Expand Down
6 changes: 3 additions & 3 deletions docs/_static/mxnet-theme/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
<div class="container">
<div class="row">
<div class="col-lg-4 col-sm-12">
<h3>MXNet 1.3.1 Released</h3>
<p>This release includes bug fixes, performance improvements, and documentation updates.</p>
<a href="https://github.com/apache/incubator-mxnet/releases/tag/1.3.1">Learn More</a>
<h3>MXNet 1.4.0 Released</h3>
<p>This release introduces the Java Inference API and Julia API, as well as Control Flow Operators, MKLDNN optimizations, and SVRG optimization.</p>
<a href="https://github.com/apache/incubator-mxnet/releases/tag/1.4.0">Learn More</a>
</div>
<div class="col-lg-4 col-sm-12">
<h3>A 60-minute Gluon Crash Course</h3>
Expand Down
Loading

0 comments on commit a3bcf9f

Please sign in to comment.