Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
Conflicts:
	.gitignore
	Makefile
  • Loading branch information
antinucleon committed Jan 13, 2016
2 parents d167481 + 5e28159 commit 71201c7
Show file tree
Hide file tree
Showing 85 changed files with 3,937 additions and 433 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,15 @@ R-package/inst/*
*.bin

# ipython notebook
example/notebooks/.ipynb_checkpoints/*
*_pb2.py
*.ipynb_checkpoints*
input.txt*

# Jetbrain
.idea

# ctags
<<<<<<< HEAD
tags


Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,7 @@ List of Contributors
* [Junru Shao](https://github.com/yzgysjr)
* [Xiao Liu](https://github.com/skylook)
* [Lowik CHANUSSOT](https://github.com/Nzeuwik)
* [Alexander Skidanov](https://github.com/SkidanovAlex)
* [Ruixiang Zhang](https://github.com/sodabeta7)
* [Lodewic van Twillert](https://github.com/Lodewic)
* [Aditya Kumar](https://github.com/hiraditya)
60 changes: 50 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,16 @@ ifeq ($(USE_DIST_KVSTORE), 1)
LDFLAGS += $(PS_LDFLAGS_A)
endif

include $(MXNET_PLUGINS)

.PHONY: clean all test lint doc clean_all rcpplint rcppexport roxygen

all: lib/libmxnet.a lib/libmxnet.so $(BIN)

SRC = $(wildcard src/*.cc src/*/*.cc)
OBJ = $(patsubst src/%.cc, build/%.o, $(SRC))
OBJ = $(patsubst %.cc, build/%.o, $(SRC))
CUSRC = $(wildcard src/*/*.cu)
CUOBJ = $(patsubst src/%.cu, build/%_gpu.o, $(CUSRC))
CUOBJ = $(patsubst %.cu, build/%_gpu.o, $(CUSRC))

ifneq ($(EXTRA_OPERATORS),)
EXTRA_SRC = $(wildcard $(EXTRA_OPERATORS)/*.cc $(EXTRA_OPERATORS)/*/*.cc)
Expand All @@ -113,10 +115,27 @@ else
EXTRA_CUOBJ =
endif

# plugin
ifeq ($(USE_TORCH), 1)
CFLAGS += -I$(TORCH_PATH)/install/include -I$(TORCH_PATH)/install/include/TH -I$(TORCH_PATH)/install/include/THC -DMXNET_USE_TORCH=1
LDFLAGS += -L$(TORCH_PATH)/install/lib -lluajit -lluaT -lTH -lTHC -L$(TORCH_PATH)/install/lib/lua/5.1 -lpaths -ltorch -lnn
ifeq ($(USE_CUDA), 1)
LDFLAGS += -lcutorch -lcunn
endif

TORCH_SRC = $(wildcard plugin/torch/*.cc)
PLUGIN_OBJ += $(patsubst %.cc, build/%.o, $(TORCH_SRC))
TORCH_CUSRC = $(wildcard plugin/torch/*.cu)
PLUGIN_CUOBJ += $(patsubst %.cu, build/%_gpu.o, $(TORCH_CUSRC))
else
CFLAGS += -DMXNET_USE_TORCH=0
endif

LIB_DEP += $(DMLC_CORE)/libdmlc.a
ALL_DEP = $(OBJ) $(EXTRA_OBJ) $(LIB_DEP) $(config)
ALL_DEP = $(OBJ) $(EXTRA_OBJ) $(PLUGIN_OBJ) $(LIB_DEP)
ifeq ($(USE_CUDA), 1)
ALL_DEP += $(CUOBJ) $(EXTRA_CUOBJ)
ALL_DEP += $(CUOBJ) $(EXTRA_CUOBJ) $(PLUGIN_CUOBJ)
LDFLAGS += -lcuda
endif

ifeq ($(USE_NVRTC), 1)
Expand All @@ -127,14 +146,25 @@ else
endif


build/%.o: src/%.cc
build/src/%.o: src/%.cc
@mkdir -p $(@D)
$(CXX) -std=c++0x $(CFLAGS) -MM -MT build/src/$*.o $< >build/src/$*.d
$(CXX) -std=c++0x -c $(CFLAGS) -c $< -o $@

build/src/%_gpu.o: src/%.cu
@mkdir -p $(@D)
$(NVCC) $(NVCCFLAGS) -Xcompiler "$(CFLAGS)" -M -MT build/src/$*_gpu.o $< >build/src/$*_gpu.d
$(NVCC) -c -o $@ $(NVCCFLAGS) -Xcompiler "$(CFLAGS)" $<

build/plugin/%.o: plugin/%.cc
@mkdir -p $(@D)
$(CXX) -std=c++0x $(CFLAGS) -MM -MT build/$*.o $< >build/$*.d
$(CXX) -std=c++0x $(CFLAGS) -MM -MT build/plugin/$*.o $< >build/plugin/$*.d
$(CXX) -std=c++0x -c $(CFLAGS) -c $< -o $@

build/%_gpu.o: src/%.cu
# A nvcc bug cause this to generate "generic/xxx.h" dependencies from torch headers.
# $(NVCC) $(NVCCFLAGS) -Xcompiler "$(CFLAGS)" -M -MT build/plugin/$*_gpu.o $< >build/plugin/$*_gpu.d
build/plugin/%_gpu.o: plugin/%.cu
@mkdir -p $(@D)
$(NVCC) $(NVCCFLAGS) -Xcompiler "$(CFLAGS)" -M -MT build/$*_gpu.o $< >build/$*_gpu.d
$(NVCC) -c -o $@ $(NVCCFLAGS) -Xcompiler "$(CFLAGS)" $<

$(EXTRA_OPERATORS)/build/%.o: $(EXTRA_OPERATORS)/%.cc
Expand All @@ -147,6 +177,8 @@ $(EXTRA_OPERATORS)/build/%_gpu.o: $(EXTRA_OPERATORS)/%.cu
$(NVCC) $(NVCCFLAGS) -Xcompiler "$(CFLAGS) -Isrc/operator" -M -MT $(EXTRA_OPERATORS)/build/$*_gpu.o $< >$(EXTRA_OPERATORS)/build/$*_gpu.d
$(NVCC) -c -o $@ $(NVCCFLAGS) -Xcompiler "$(CFLAGS) -Isrc/operator" $<

# NOTE: to statically link libmxnet.a we need the option
# --Wl,--whole-archive -lmxnet --Wl,--no-whole-archive
lib/libmxnet.a: $(ALL_DEP)
@mkdir -p $(@D)
ar crv $@ $(filter %.o, $?)
Expand All @@ -161,7 +193,6 @@ lib/libmxnet.so: $(ALL_DEP) copy_cuda_deps
@mkdir -p $(@D)
$(CXX) $(CFLAGS) -shared -o $@ $(filter %.o %.a, $^) $(LDFLAGS)

# ps-lite
$(PS_PATH)/build/libps.a:
$(MAKE) CXX=$(CXX) DEPS_PATH=$(DEPS_PATH) -C $(PS_PATH) ps
ln -fs $(PS_PATH)/tracker .
Expand All @@ -180,7 +211,7 @@ include tests/cpp/unittest.mk
test: $(TEST)

lint: rcpplint
python2 dmlc-core/scripts/lint.py mxnet ${LINT_LANG} include src scripts python predict/python
python2 dmlc-core/scripts/lint.py mxnet ${LINT_LANG} include src plugin scripts python predict/python

doc: doxygen

Expand All @@ -206,15 +237,24 @@ rpkg: roxygen
cp -rf dmlc-core/include/* R-package/inst/include/
R CMD build --no-build-vignettes R-package

ifneq ($(EXTRA_OPERATORS),)
clean:
$(RM) -r build lib bin *~ */*~ */*/*~ */*/*/*~
cd $(DMLC_CORE); make clean; cd -
cd $(PS_PATH); make clean; cd -
$(RM) -r $(EXTRA_OPERATORS)/build
else
clean:
$(RM) -r build lib bin *~ */*~ */*/*~ */*/*/*~
cd $(DMLC_CORE); make clean; cd -
cd $(PS_PATH); make clean; cd -
endif

clean_all: clean

-include build/*.d
-include build/*/*.d
-include build/*/*/*.d
ifneq ($(EXTRA_OPERATORS),)
-include $(EXTRA_OPERATORS)/build/*.d
endif
2 changes: 1 addition & 1 deletion R-package/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BugReports: https://github.com/dmlc/mxnet/issues
Imports:
methods,
Rcpp (>= 0.12.1),
DiagrammeR,
DiagrammeR (>= 0.8.1),
data.table,
jsonlite,
magrittr,
Expand Down
3 changes: 3 additions & 0 deletions R-package/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export(mx.model.FeedForward.create)
export(mx.model.load)
export(mx.model.save)
export(mx.nd.abs)
export(mx.nd.argmax.channel)
export(mx.nd.array)
export(mx.nd.ceil)
export(mx.nd.choose.element.0index)
Expand Down Expand Up @@ -77,8 +78,10 @@ export(mx.simple.bind)
export(mx.symbol.Activation)
export(mx.symbol.BatchNorm)
export(mx.symbol.BlockGrad)
export(mx.symbol.Cast)
export(mx.symbol.Concat)
export(mx.symbol.Convolution)
export(mx.symbol.Crop)
export(mx.symbol.Deconvolution)
export(mx.symbol.Dropout)
export(mx.symbol.ElementWiseSum)
Expand Down
64 changes: 64 additions & 0 deletions R-package/R/mxnet_generated.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
#' @name mx.nd.abs
NULL

#' Take sum of the src.The result will be ndarray of shape (1,) on the same device.
#'
#' @param src NDArray
#' Source input to the function
#' @return out The result mx.ndarray
#'
#' @export
#' @name mx.nd.argmax.channel
NULL

#' Take ceil value of the src
#'
#' @param src NDArray
Expand Down Expand Up @@ -269,12 +279,20 @@ mx.io.CSVIter <- function(...) {
#' Augmentation Param: Maxmum image size after resizing.
#' @param min.img.size float, optional, default=0
#' Augmentation Param: Minimum image size after resizing.
#' @param random.h int, optional, default='0'
#' Augmentation Param: Maximum value of H channel in HSL color space.
#' @param random.s int, optional, default='0'
#' Augmentation Param: Maximum value of S channel in HSL color space.
#' @param random.l int, optional, default='0'
#' Augmentation Param: Maximum value of L channel in HSL color space.
#' @param rotate int, optional, default='-1'
#' Augmentation Param: Rotate angle.
#' @param fill.value int, optional, default='255'
#' Augmentation Param: Maximum value of illumination variation.
#' @param data.shape Shape(tuple), required
#' Dataset Param: Shape of each instance generated by the DataIter.
#' @param inter.method int, optional, default='1'
#' Augmentation Param: 0-NN 1-bilinear 2-cubic 3-area 4-lanczos4 9-auto 10-rand.
#' @param mirror boolean, optional, default=False
#' Augmentation Param: Whether to mirror the image.
#' @param rand.mirror boolean, optional, default=False
Expand Down Expand Up @@ -378,6 +396,21 @@ mx.symbol.BlockGrad <- function(...) {
mx.varg.symbol.BlockGrad(list(...))
}

#' Cast array to a different data type.
#'
#' @param data Symbol
#' Input data to cast function.
#' @param dtype {'float16', 'float32', 'float64', 'int32', 'uint8'}, required
#' Target data type.
#' @param name string, optional
#' Name of the resulting symbol.
#' @return out The result mx.symbol
#'
#' @export
mx.symbol.Cast <- function(...) {
mx.varg.symbol.Cast(list(...))
}

#' Perform an feature concat on channel dim (dim 1) over all the inputs.
#'
#' @param num.args int, required
Expand Down Expand Up @@ -405,6 +438,8 @@ mx.symbol.Concat <- function(...) {
#' convolution kernel size: (y, x)
#' @param stride Shape(tuple), optional, default=(1, 1)
#' convolution stride: (y, x)
#' @param dilate Shape(tuple), optional, default=(1, 1)
#' convolution dilate: (y, x)
#' @param pad Shape(tuple), optional, default=(0, 0)
#' pad for convolution: (y, x)
#' @param num.filter int (non-negative), required
Expand All @@ -424,6 +459,25 @@ mx.symbol.Convolution <- function(...) {
mx.varg.symbol.Convolution(list(...))
}

#' Crop the 2th and 3th dim of input data, with the corresponding size of w_h orwith widht and height of the second input symbol
#'
#' @param num.args int, required
#' Number of inputs for crop, if equals one, then we will use the h_wfor crop heihgt and width, else if equals two, then we will use the heightand width of the second input symbol, we name crop_like here
#' @param offset Shape(tuple), optional, default=(0, 0)
#' corp offset coordinate: (y, x)
#' @param h.w Shape(tuple), optional, default=(0, 0)
#' corp height and weight: (h, w)
#' @param center.crop boolean, optional, default=False
#' If set to true, then it will use be the center_crop,or it will crop using the shape of crop_like
#' @param name string, optional
#' Name of the resulting symbol.
#' @return out The result mx.symbol
#'
#' @export
mx.symbol.Crop <- function(...) {
mx.varg.symbol.Crop(list(...))
}

#' Apply deconvolution to input then add a bias.
#'
#' @param data Symbol
Expand Down Expand Up @@ -704,8 +758,12 @@ mx.symbol.SliceChannel <- function(...) {
#' Input data to softmax.
#' @param grad.scale float, optional, default=1
#' Scale the gradient by a float factor
#' @param ignore.label float, optional, default=-1
#' the ignore_label will not work in backward, and this onlybe used when multi_output=true
#' @param multi.output boolean, optional, default=False
#' If set to true, for a (n,k,x_1,..,x_n) dimensionalinput tensor, softmax will generate n*x_1*...*x_n output, eachhas k classes
#' @param use.ignore boolean, optional, default=False
#' If set to true, the ignore_label value will not contributorto the backward gradient
#' @param name string, optional
#' Name of the resulting symbol.
#' @return out The result mx.symbol
Expand Down Expand Up @@ -736,8 +794,12 @@ mx.symbol.SoftmaxActivation <- function(...) {
#' Input data to softmax.
#' @param grad.scale float, optional, default=1
#' Scale the gradient by a float factor
#' @param ignore.label float, optional, default=-1
#' the ignore_label will not work in backward, and this onlybe used when multi_output=true
#' @param multi.output boolean, optional, default=False
#' If set to true, for a (n,k,x_1,..,x_n) dimensionalinput tensor, softmax will generate n*x_1*...*x_n output, eachhas k classes
#' @param use.ignore boolean, optional, default=False
#' If set to true, the ignore_label value will not contributorto the backward gradient
#' @param name string, optional
#' Name of the resulting symbol.
#' @return out The result mx.symbol
Expand Down Expand Up @@ -772,6 +834,8 @@ mx.symbol.SwapAxis <- function(...) {
#' Input filter. Only used by nearest sample_type.
#' @param sample.type {'bilinear', 'nearest'}, required
#' upsampling method
#' @param multi.input.mode {'concat', 'sum'},optional, default='concat'
#' How to handle multiple input. concat means concatenate upsampled images along the channel dimension. sum means add all images together, only available for nearest neighbor upsampling.
#' @param num.args int, required
#' Number of inputs to be upsampled. For nearest neighbor upsampling, this can be 1-N; the size of output will be(scale*h_0,scale*w_0) and all other inputs will be upsampled to thesame size. For bilinear upsampling this must be 2; 1 input and 1 weight.
#' @param name string, optional
Expand Down
12 changes: 12 additions & 0 deletions R-package/man/mx.io.ImageRecordIter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions R-package/man/mx.nd.argmax.channel.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions R-package/man/mx.symbol.Cast.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions R-package/man/mx.symbol.Convolution.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 71201c7

Please sign in to comment.