[GitHub] kohillyang opened a new issue #8614: Does mxnet.symbol.SoftmaxOutput support matrix label?
kohillyang opened a new issue #8614: Does mxnet.symbol.SoftmaxOutput support matrix label? URL: https://github.com/apache/incubator-mxnet/issues/8614 Assume I have several Matrix classes, they are mutually exclusive, which means that the sum of them must be a matrix whose all items is 1. Can I use Softmax_output to predict these classes? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] cjolivier01 commented on issue #8599: Pull more optimize and simplification changes from tuner branch
cjolivier01 commented on issue #8599: Pull more optimize and simplification changes from tuner branch URL: https://github.com/apache/incubator-mxnet/pull/8599#issuecomment-343376929 I am doing rebase, no idea why it is showing baaafc5 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] stoneyang commented on issue #1217: Resume training failed
stoneyang commented on issue #1217: Resume training failed URL: https://github.com/apache/incubator-mxnet/issues/1217#issuecomment-343637129 Thanks for sharing your experience! @fengjunlv This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] ZiyueHuang commented on issue #8259: check_format of sparse ndrray
ZiyueHuang commented on issue #8259: check_format of sparse ndrray URL: https://github.com/apache/incubator-mxnet/pull/8259#issuecomment-343634820 The result err number will be returned to `SyncCheckFormat` in ndarray.cc and do the check there. `CheckFormatImpl` can be used in other OPs in backend. For the user side, the behavior is the same with scipy, i.e. `arr.check_format()` will raise error and the meaningful err message if the sparse arr is invalid. @piiswrong This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[incubator-mxnet] branch master updated: use first class cuda with cmake 3.9 and cuda9.0 support (#8572)
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 35ceea7 use first class cuda with cmake 3.9 and cuda9.0 support (#8572) 35ceea7 is described below commit 35ceea73ccc1acfb2ec62cdaa841822e51c13456 Author: Hu ShiwenAuthorDate: Sat Nov 11 10:55:44 2017 +0800 use first class cuda with cmake 3.9 and cuda9.0 support (#8572) * use first class cuda with cmake 3.9 and cuda9.0 support fix lapack auto use with openblas * change name --- CMakeLists.txt | 133 --- cmake/ChooseBlas.cmake | 58 ++ cmake/FirstClassLangCuda.cmake | 236 + 3 files changed, 386 insertions(+), 41 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 539515b..af681d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,35 @@ cmake_minimum_required(VERSION 3.0.2) -project(mxnet C CXX) +if((${CMAKE_VERSION} VERSION_GREATER "3.9.0") OR (${CMAKE_VERSION} VERSION_EQUAL "3.9.0")) + set(FIRST_CUDA TRUE) +else() + set(FIRST_CUDA FALSE) +endif() +include(cmake/Utils.cmake) -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build/private/local_config.cmake) - include(${CMAKE_CURRENT_SOURCE_DIR}/build/private/local_config.cmake) +#Some things have order. This must be put in front alone +mxnet_option(USE_CUDA "Build with CUDA support" ON) +mxnet_option(USE_OLDCMAKECUDA "Build with old cmake cuda" OFF) +if(USE_CUDA) + add_definitions(-DMSHADOW_USE_CUDA=1) + IF(FIRST_CUDA AND (NOT USE_OLDCMAKECUDA)) +set(__cuda_toolset "7.5" "8.0" "9.0") +set(CUDA_TOOLSET "8.0" CACHE STRING "Select CUDA Version.") +set_property( CACHE CUDA_TOOLSET PROPERTY STRINGS "" ${__cuda_toolset} ) +set(CMAKE_GENERATOR_TOOLSET "cuda=${CUDA_TOOLSET},host=x64") +project(mxnet C CXX CUDA) + else() +project(mxnet C CXX) +set(FIRST_CUDA FALSE) + endif() +else() + project(mxnet C CXX) + add_definitions(-DMSHADOW_USE_CUDA=0) endif() -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules;${CMAKE_MODULE_PATH}") -include(cmake/Utils.cmake) mxnet_option(USE_OPENCV "Build with OpenCV support" ON) mxnet_option(USE_OPENMP "Build with Openmp support" ON) -mxnet_option(USE_CUDA "Build with CUDA support" ON) mxnet_option(USE_CUDNN"Build with cudnn support" ON) # one could set CUDNN_ROOT for search path mxnet_option(USE_LAPACK "Build with lapack support" ON IF NOT MSVC) mxnet_option(USE_MKL_IF_AVAILABLE "Use MKL if found" ON) @@ -29,6 +47,17 @@ mxnet_option(USE_GPROF"Compile with gprof (profiling) flag" OFF) mxnet_option(USE_VTUNE"Enable use of Intel Amplifier XE (VTune)" OFF) # one could set VTUNE_ROOT for search path mxnet_option(INSTALL_EXAMPLES "Install the example source files." OFF) + + +if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build/private/local_config.cmake) + include(${CMAKE_CURRENT_SOURCE_DIR}/build/private/local_config.cmake) +endif() + +set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules;${CMAKE_MODULE_PATH}") + + + + SET(EXTRA_OPERATORS "" CACHE PATH "EXTRA OPERATORS PATH") if("$ENV{VERBOSE}" STREQUAL "1") @@ -128,14 +157,20 @@ endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) -if(EXISTS ${PROJECT_SOURCE_DIR}/mshadow/cmake) - include(mshadow/cmake/mshadow.cmake) +if(FIRST_CUDA) + include(cmake/ChooseBlas.cmake) include(mshadow/cmake/Utils.cmake) - include(mshadow/cmake/Cuda.cmake) + include(cmake/FirstClassLangCuda.cmake) else() - include(mshadowUtils) - include(Cuda) - include(mshadow) + if(EXISTS ${PROJECT_SOURCE_DIR}/mshadow/cmake) +include(mshadow/cmake/mshadow.cmake) +include(mshadow/cmake/Utils.cmake) +include(mshadow/cmake/Cuda.cmake) + else() +include(mshadowUtils) +include(Cuda) +include(mshadow) + endif() endif() list(APPEND mxnet_LINKER_LIBS ${mshadow_LINKER_LIBS}) @@ -241,7 +276,7 @@ if(USE_LAPACK) list(APPEND mxnet_LINKER_LIBS lapack) else(USE_LAPACK) # Workaround for Windows until using new Jenkinsfile. - if(USE_BLAS STREQUAL "open") + if(BLAS STREQUAL "Open" OR BLAS STREQUAL "open") add_definitions(-DMXNET_USE_LAPACK=1) endif() endif() @@ -372,36 +407,46 @@ if(MSVC) endif() if(USE_CUDA) - list(APPEND CUDA_INCLUDE_DIRS ${INCLUDE_DIRECTORIES}) - # define preprocessor macro so that we will not include the generated forcelink header - mshadow_cuda_compile(cuda_objs ${CUDA}) - if(MSVC) -FIND_LIBRARY(CUDA_nvrtc_LIBRARY nvrtc "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" "${CUDA_TOOLKIT_ROOT_DIR}/lib/win32") -list(APPEND mxnet_LINKER_LIBS ${CUDA_nvrtc_LIBRARY}) -set(CUDA_cuda_LIBRARY
[GitHub] cjolivier01 closed pull request #8572: use first class cuda with cmake 3.9 and cuda9.0 support
cjolivier01 closed pull request #8572: use first class cuda with cmake 3.9 and cuda9.0 support URL: https://github.com/apache/incubator-mxnet/pull/8572 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/CMakeLists.txt b/CMakeLists.txt index 539515b3a2..af681d00aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,35 @@ cmake_minimum_required(VERSION 3.0.2) -project(mxnet C CXX) +if((${CMAKE_VERSION} VERSION_GREATER "3.9.0") OR (${CMAKE_VERSION} VERSION_EQUAL "3.9.0")) + set(FIRST_CUDA TRUE) +else() + set(FIRST_CUDA FALSE) +endif() +include(cmake/Utils.cmake) -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build/private/local_config.cmake) - include(${CMAKE_CURRENT_SOURCE_DIR}/build/private/local_config.cmake) +#Some things have order. This must be put in front alone +mxnet_option(USE_CUDA "Build with CUDA support" ON) +mxnet_option(USE_OLDCMAKECUDA "Build with old cmake cuda" OFF) +if(USE_CUDA) + add_definitions(-DMSHADOW_USE_CUDA=1) + IF(FIRST_CUDA AND (NOT USE_OLDCMAKECUDA)) +set(__cuda_toolset "7.5" "8.0" "9.0") +set(CUDA_TOOLSET "8.0" CACHE STRING "Select CUDA Version.") +set_property( CACHE CUDA_TOOLSET PROPERTY STRINGS "" ${__cuda_toolset} ) +set(CMAKE_GENERATOR_TOOLSET "cuda=${CUDA_TOOLSET},host=x64") +project(mxnet C CXX CUDA) + else() +project(mxnet C CXX) +set(FIRST_CUDA FALSE) + endif() +else() + project(mxnet C CXX) + add_definitions(-DMSHADOW_USE_CUDA=0) endif() -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules;${CMAKE_MODULE_PATH}") -include(cmake/Utils.cmake) mxnet_option(USE_OPENCV "Build with OpenCV support" ON) mxnet_option(USE_OPENMP "Build with Openmp support" ON) -mxnet_option(USE_CUDA "Build with CUDA support" ON) mxnet_option(USE_CUDNN"Build with cudnn support" ON) # one could set CUDNN_ROOT for search path mxnet_option(USE_LAPACK "Build with lapack support" ON IF NOT MSVC) mxnet_option(USE_MKL_IF_AVAILABLE "Use MKL if found" ON) @@ -29,6 +47,17 @@ mxnet_option(USE_GPROF"Compile with gprof (profiling) flag" OFF) mxnet_option(USE_VTUNE"Enable use of Intel Amplifier XE (VTune)" OFF) # one could set VTUNE_ROOT for search path mxnet_option(INSTALL_EXAMPLES "Install the example source files." OFF) + + +if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build/private/local_config.cmake) + include(${CMAKE_CURRENT_SOURCE_DIR}/build/private/local_config.cmake) +endif() + +set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules;${CMAKE_MODULE_PATH}") + + + + SET(EXTRA_OPERATORS "" CACHE PATH "EXTRA OPERATORS PATH") if("$ENV{VERBOSE}" STREQUAL "1") @@ -128,14 +157,20 @@ endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) -if(EXISTS ${PROJECT_SOURCE_DIR}/mshadow/cmake) - include(mshadow/cmake/mshadow.cmake) +if(FIRST_CUDA) + include(cmake/ChooseBlas.cmake) include(mshadow/cmake/Utils.cmake) - include(mshadow/cmake/Cuda.cmake) + include(cmake/FirstClassLangCuda.cmake) else() - include(mshadowUtils) - include(Cuda) - include(mshadow) + if(EXISTS ${PROJECT_SOURCE_DIR}/mshadow/cmake) +include(mshadow/cmake/mshadow.cmake) +include(mshadow/cmake/Utils.cmake) +include(mshadow/cmake/Cuda.cmake) + else() +include(mshadowUtils) +include(Cuda) +include(mshadow) + endif() endif() list(APPEND mxnet_LINKER_LIBS ${mshadow_LINKER_LIBS}) @@ -241,7 +276,7 @@ if(USE_LAPACK) list(APPEND mxnet_LINKER_LIBS lapack) else(USE_LAPACK) # Workaround for Windows until using new Jenkinsfile. - if(USE_BLAS STREQUAL "open") + if(BLAS STREQUAL "Open" OR BLAS STREQUAL "open") add_definitions(-DMXNET_USE_LAPACK=1) endif() endif() @@ -372,36 +407,46 @@ if(MSVC) endif() if(USE_CUDA) - list(APPEND CUDA_INCLUDE_DIRS ${INCLUDE_DIRECTORIES}) - # define preprocessor macro so that we will not include the generated forcelink header - mshadow_cuda_compile(cuda_objs ${CUDA}) - if(MSVC) -FIND_LIBRARY(CUDA_nvrtc_LIBRARY nvrtc "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" "${CUDA_TOOLKIT_ROOT_DIR}/lib/win32") -list(APPEND mxnet_LINKER_LIBS ${CUDA_nvrtc_LIBRARY}) -set(CUDA_cuda_LIBRARY "${CUDA_nvrtc_LIBRARY}/../cuda.lib") -list(APPEND mxnet_LINKER_LIBS ${CUDA_cuda_LIBRARY}) -FIND_LIBRARY(CUDA_cufft_LIBRARY nvrtc "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" "${CUDA_TOOLKIT_ROOT_DIR}/lib/win32") -list(APPEND mxnet_LINKER_LIBS "${CUDA_cufft_LIBRARY}/../cufft.lib") # For fft operator -FIND_LIBRARY(CUDA_cusolver_LIBRARY nvrtc "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" "${CUDA_TOOLKIT_ROOT_DIR}/lib/win32") -list(APPEND mxnet_LINKER_LIBS "${CUDA_cusolver_LIBRARY}/../cusolver.lib") # For
[GitHub] ZiyueHuang commented on issue #8259: check_format of sparse ndrray
ZiyueHuang commented on issue #8259: check_format of sparse ndrray URL: https://github.com/apache/incubator-mxnet/pull/8259#issuecomment-343634820 The result err number will be returned to SyncCheckFormat in ndarray.cc and do the check there. CheckFormatImpl can be used in other OPs in backend. For the user side, the behavior is the same with scipy, i.e. arr.check_format will raise error and the meaningful err message if the sparse arr is invalid. @piiswrong This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] ZiyueHuang commented on a change in pull request #8259: check_format of sparse ndrray
ZiyueHuang commented on a change in pull request #8259: check_format of sparse ndrray URL: https://github.com/apache/incubator-mxnet/pull/8259#discussion_r150372061 ## File path: src/common/utils.h ## @@ -43,9 +43,177 @@ #include #include +#include "../operator/mxnet_op.h" + namespace mxnet { namespace common { + +/*! + * \brief IndPtr should be non-negative, in non-decreasing order, start with 0 + * and end with value equal with size of indices. + */ +struct csr_indptr_check { + template + MSHADOW_XINLINE static void Map(int i, DType* out, const IType* indptr, + const nnvm::dim_t end, const nnvm::dim_t idx_size) { +if (indptr[i+1] < 0 || indptr[i+1] < indptr[i] || +(i == 0 && indptr[i] != 0) || +(i == end - 1 && indptr[end] != idx_size)) + *out = kCSRIndPtrErr; + } +}; + +/*! + * \brief Indices should be non-negative, less than the number of columns + * and in ascending order per row. + */ +struct csr_idx_check { + template + MSHADOW_XINLINE static void Map(int i, DType* out, const IType* idx, + const RType* indptr, const nnvm::dim_t ncols) { +for (RType j = indptr[i]; j < indptr[i+1]; j++) { + if (idx[j] >= ncols || idx[j] < 0 || + (j < indptr[i+1] - 1 && idx[j] >= idx[j+1])) { +*out = kCSRIdxErr; +break; + } +} + } +}; + +/*! + * \brief Indices of RSPNDArray should be non-negative, + * less than the size of first dimension and in ascending order + */ +struct rsp_idx_check { + template + MSHADOW_XINLINE static void Map(int i, DType* out, const IType* idx, + const nnvm::dim_t end, const nnvm::dim_t nrows) { +if ((i < end && idx[i+1] <= idx[i]) +|| idx[i] < 0 || idx[i] >= nrows) + *out = kRSPIdxErr; + } +}; + +template +void CheckFormatWrapper(const RunContext , const NDArray , +const TBlob _cpu, const bool full_check); + +/*! + * \brief Check the validity of CSRNDArray. + * \param rctx Execution context. + * \param input Input NDArray of CSRStorage. + * \param err_cpu Error number on cpu. + * \param full_check If true, rigorous check, O(N) operations, + * otherwise basic check, O(1) operations. + */ +template +void CheckFormatCSRImpl(const RunContext , const NDArray , +const TBlob _cpu, const bool full_check) { + using namespace op::mxnet_op; + CHECK_EQ(input.storage_type(), kCSRStorage) + << "CheckFormatCSRImpl is for CSRNDArray"; + const TShape shape = input.shape(); + const TShape idx_shape = input.aux_shape(csr::kIdx); + const TShape indptr_shape = input.aux_shape(csr::kIndPtr); + const TShape storage_shape = input.storage_shape(); + if ((shape.ndim() != 2) || + (idx_shape.ndim() != 1 || indptr_shape.ndim() != 1 || storage_shape.ndim() != 1) || + (indptr_shape[0] != shape[0] + 1) || + (idx_shape[0] != storage_shape[0])) { + MSHADOW_TYPE_SWITCH(err_cpu.type_flag_, DType, { + DType* err = err_cpu.dptr(); + *err = kCSRShapeErr; + }); + return; + } + if (full_check) { +MSHADOW_TYPE_SWITCH(err_cpu.type_flag_, DType, { + MSHADOW_IDX_TYPE_SWITCH(input.aux_type(csr::kIndPtr), RType, { +MSHADOW_IDX_TYPE_SWITCH(input.aux_type(csr::kIdx), IType, { + mshadow::Stream *s = rctx.get_stream(); + NDArray ret_xpu = NDArray(mshadow::Shape1(1), +rctx.get_ctx(), false, err_cpu.type_flag_); + TBlob val_xpu = ret_xpu.data(); + Kernel::Launch(s, val_xpu.Size(), val_xpu.dptr()); Review comment: This array, ret_xpu, is of shape (1, ) and just hold the err number. So it is set to kNormalErr initially. This array is created on the same context of source array and used for kernel launch. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] ZiyueHuang commented on a change in pull request #8611: optimization for dot(csr.T, dense) = rsp
ZiyueHuang commented on a change in pull request #8611: optimization for dot(csr.T, dense) = rsp URL: https://github.com/apache/incubator-mxnet/pull/8611#discussion_r150371782 ## File path: src/operator/tensor/dot-inl.h ## @@ -598,40 +614,52 @@ inline void DotCsrDnsRspImpl(const OpContext& ctx, const TBlob col_idx_l = lhs.aux_data(csr::kIdx); const TBlob& data_r = rhs; - // pre-allocate spaces for ret using the dense dimension size - ret->CheckAndAlloc({mshadow::Shape1(lhs.shape()[1])}); - const TBlob data_out = ret->data(); - const TBlob row_idx_out = ret->aux_data(rowsparse::kIdx); - MSHADOW_SGL_DBL_TYPE_SWITCH(data_l.type_flag_, DType, { // data type MSHADOW_IDX_TYPE_SWITCH(indptr_l.type_flag_, IType, { // indptr type MSHADOW_IDX_TYPE_SWITCH(col_idx_l.type_flag_, CType, { // col idx type -MSHADOW_IDX_TYPE_SWITCH(row_idx_out.type_flag_, RType, { // row idx type +MSHADOW_IDX_TYPE_SWITCH(ret->aux_type(rowsparse::kIdx), RType, { // row idx type + const dim_t num_rows = lhs.shape()[1]; + size_t workspace_size = 2 * (num_rows * sizeof(dim_t)); + mshadow::Tensorworkspace = +ctx.requested[0].get_space_typed ( +mshadow::Shape1(workspace_size), s); + dim_t* row_flg = reinterpret_cast (workspace.dptr_); + dim_t* prefix_sum = row_flg + num_rows; + + Fill(s, TBlob(row_flg, mshadow::Shape1(num_rows), cpu::kDevMask), kWriteTo, 0); + mxnet_op::Kernel ::Launch(s, lhs.aux_shape(csr::kIdx)[0], row_flg, +col_idx_l.dptr()); + + prefix_sum[0] = row_flg[0]; + for (nnvm::dim_t i = 1; i < num_rows; i++) { +prefix_sum[i] = prefix_sum[i - 1] + row_flg[i]; + } + dim_t nnr = prefix_sum[num_rows - 1]; + + if (nnr == 0) { +FillZerosRspImpl(s, *ret); +return; + } + + ret->CheckAndAlloc({mshadow::Shape1(nnr)}); + const TBlob& data_out = ret->data(); + const TBlob& row_idx = ret->aux_data(rowsparse::kIdx); + dim_t num_threads = data_out.Size(); mxnet_op::Kernel ::Launch(s, num_threads, data_out.dptr()); - RType* row_idx = row_idx_out.dptr(); - num_threads = row_idx_out.Size(); - mxnet_op::Kernel ::Launch(s, num_threads, row_idx); - num_threads = mxnet_op::get_num_threads(data_out.shape_[0]); - dim_t seg_len = (data_out.shape_[0] + num_threads - 1) / num_threads; + RType* row_idx_out = row_idx.dptr(); + + mxnet_op::Kernel ::Launch(s, num_rows, +row_idx_out, prefix_sum, num_rows); + + num_threads = mxnet_op::get_num_threads(ret->shape()[0]); + dim_t seg_len = (ret->shape()[0] + num_threads - 1) / num_threads; Review comment: I think no, this range should cover num_cols of csr, i.e. num_rows of output. So nnr is not helpful for this kernel. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] thirdwing closed pull request #8121: [R] Initializer fix and adjustments to RNN API
thirdwing closed pull request #8121: [R] Initializer fix and adjustments to RNN API URL: https://github.com/apache/incubator-mxnet/pull/8121 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/R-package/R/gru.R b/R-package/R/gru.R deleted file mode 100644 index d2ffd9a414..00 --- a/R-package/R/gru.R +++ /dev/null @@ -1,355 +0,0 @@ -# gru cell symbol -gru <- function(num.hidden, indata, prev.state, param, seqidx, layeridx, dropout=0) { -if (dropout > 0) -indata <- mx.symbol.Dropout(data=indata, p=dropout) -i2h <- mx.symbol.FullyConnected(data=indata, -weight=param$gates.i2h.weight, -bias=param$gates.i2h.bias, -num.hidden=num.hidden * 2, -name=paste0("t", seqidx, ".l", layeridx, ".gates.i2h")) -h2h <- mx.symbol.FullyConnected(data=prev.state$h, -weight=param$gates.h2h.weight, -bias=param$gates.h2h.bias, -num.hidden=num.hidden * 2, -name=paste0("t", seqidx, ".l", layeridx, ".gates.h2h")) -gates <- i2h + h2h -slice.gates <- mx.symbol.SliceChannel(gates, num.outputs=2, - name=paste0("t", seqidx, ".l", layeridx, ".slice")) -update.gate <- mx.symbol.Activation(slice.gates[[1]], act.type="sigmoid") -reset.gate <- mx.symbol.Activation(slice.gates[[2]], act.type="sigmoid") - -htrans.i2h <- mx.symbol.FullyConnected(data=indata, - weight=param$trans.i2h.weight, - bias=param$trans.i2h.bias, - num.hidden=num.hidden, - name=paste0("t", seqidx, ".l", layeridx, ".trans.i2h")) -h.after.reset <- prev.state$h * reset.gate -htrans.h2h <- mx.symbol.FullyConnected(data=h.after.reset, - weight=param$trans.h2h.weight, - bias=param$trans.h2h.bias, - num.hidden=num.hidden, - name=paste0("t", seqidx, ".l", layeridx, ".trans.h2h")) -h.trans <- htrans.i2h + htrans.h2h -h.trans.active <- mx.symbol.Activation(h.trans, act.type="tanh") -next.h <- prev.state$h + update.gate * (h.trans.active - prev.state$h) -return (list(h=next.h)) -} - -# unrolled gru network -gru.unroll <- function(num.gru.layer, seq.len, input.size, - num.hidden, num.embed, num.label, dropout=0) { -embed.weight <- mx.symbol.Variable("embed.weight") -cls.weight <- mx.symbol.Variable("cls.weight") -cls.bias <- mx.symbol.Variable("cls.bias") -param.cells <- lapply(1:num.gru.layer, function(i) { -cell <- list(gates.i2h.weight = mx.symbol.Variable(paste0("l", i, ".gates.i2h.weight")), - gates.i2h.bias = mx.symbol.Variable(paste0("l", i, ".gates.i2h.bias")), - gates.h2h.weight = mx.symbol.Variable(paste0("l", i, ".gates.h2h.weight")), - gates.h2h.bias = mx.symbol.Variable(paste0("l", i, ".gates.h2h.bias")), - trans.i2h.weight = mx.symbol.Variable(paste0("l", i, ".trans.i2h.weight")), - trans.i2h.bias = mx.symbol.Variable(paste0("l", i, ".trans.i2h.bias")), - trans.h2h.weight = mx.symbol.Variable(paste0("l", i, ".trans.h2h.weight")), - trans.h2h.bias = mx.symbol.Variable(paste0("l", i, ".trans.h2h.bias"))) -return (cell) -}) -last.states <- lapply(1:num.gru.layer, function(i) { -state <- list(h=mx.symbol.Variable(paste0("l", i, ".init.h"))) -return (state) -}) - -# embeding layer -label <- mx.symbol.Variable("label") -data <- mx.symbol.Variable("data") -embed <- mx.symbol.Embedding(data=data, input.dim=input.size, - weight=embed.weight, output.dim=num.embed, name='embed') -wordvec <- mx.symbol.SliceChannel(data=embed, num.outputs=seq.len, squeeze.axis=1) - -last.hidden <- list() -for (seqidx in 1:seq.len) { -hidden <- wordvec[[seqidx]] -# stack GRU -for (i in 1:num.gru.layer) { -dp <- ifelse(i==1, 0, dropout) -next.state <- gru(num.hidden, indata=hidden, - prev.state=last.states[[i]], - param=param.cells[[i]], - seqidx=seqidx, layeridx=i, - dropout=dp) -
[incubator-mxnet] branch master updated: [R] Initializer fix and adjustments to RNN API (#8121)
This is an automated email from the ASF dual-hosted git repository. qkou 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 5c8981a [R] Initializer fix and adjustments to RNN API (#8121) 5c8981a is described below commit 5c8981a740d7e05afb664f2228b85eb22a6d1666 Author: jeremiedbAuthorDate: Fri Nov 10 21:24:25 2017 -0500 [R] Initializer fix and adjustments to RNN API (#8121) --- R-package/R/gru.R | 355 -- R-package/R/initializer.R | 32 ++-- R-package/R/lstm.R| 388 -- R-package/R/rnn.graph.R | 160 --- R-package/R/viz.graph.R | 9 +- 5 files changed, 125 insertions(+), 819 deletions(-) diff --git a/R-package/R/gru.R b/R-package/R/gru.R deleted file mode 100644 index d2ffd9a..000 --- a/R-package/R/gru.R +++ /dev/null @@ -1,355 +0,0 @@ -# gru cell symbol -gru <- function(num.hidden, indata, prev.state, param, seqidx, layeridx, dropout=0) { -if (dropout > 0) -indata <- mx.symbol.Dropout(data=indata, p=dropout) -i2h <- mx.symbol.FullyConnected(data=indata, -weight=param$gates.i2h.weight, -bias=param$gates.i2h.bias, -num.hidden=num.hidden * 2, -name=paste0("t", seqidx, ".l", layeridx, ".gates.i2h")) -h2h <- mx.symbol.FullyConnected(data=prev.state$h, -weight=param$gates.h2h.weight, -bias=param$gates.h2h.bias, -num.hidden=num.hidden * 2, -name=paste0("t", seqidx, ".l", layeridx, ".gates.h2h")) -gates <- i2h + h2h -slice.gates <- mx.symbol.SliceChannel(gates, num.outputs=2, - name=paste0("t", seqidx, ".l", layeridx, ".slice")) -update.gate <- mx.symbol.Activation(slice.gates[[1]], act.type="sigmoid") -reset.gate <- mx.symbol.Activation(slice.gates[[2]], act.type="sigmoid") - -htrans.i2h <- mx.symbol.FullyConnected(data=indata, - weight=param$trans.i2h.weight, - bias=param$trans.i2h.bias, - num.hidden=num.hidden, - name=paste0("t", seqidx, ".l", layeridx, ".trans.i2h")) -h.after.reset <- prev.state$h * reset.gate -htrans.h2h <- mx.symbol.FullyConnected(data=h.after.reset, - weight=param$trans.h2h.weight, - bias=param$trans.h2h.bias, - num.hidden=num.hidden, - name=paste0("t", seqidx, ".l", layeridx, ".trans.h2h")) -h.trans <- htrans.i2h + htrans.h2h -h.trans.active <- mx.symbol.Activation(h.trans, act.type="tanh") -next.h <- prev.state$h + update.gate * (h.trans.active - prev.state$h) -return (list(h=next.h)) -} - -# unrolled gru network -gru.unroll <- function(num.gru.layer, seq.len, input.size, - num.hidden, num.embed, num.label, dropout=0) { -embed.weight <- mx.symbol.Variable("embed.weight") -cls.weight <- mx.symbol.Variable("cls.weight") -cls.bias <- mx.symbol.Variable("cls.bias") -param.cells <- lapply(1:num.gru.layer, function(i) { -cell <- list(gates.i2h.weight = mx.symbol.Variable(paste0("l", i, ".gates.i2h.weight")), - gates.i2h.bias = mx.symbol.Variable(paste0("l", i, ".gates.i2h.bias")), - gates.h2h.weight = mx.symbol.Variable(paste0("l", i, ".gates.h2h.weight")), - gates.h2h.bias = mx.symbol.Variable(paste0("l", i, ".gates.h2h.bias")), - trans.i2h.weight = mx.symbol.Variable(paste0("l", i, ".trans.i2h.weight")), - trans.i2h.bias = mx.symbol.Variable(paste0("l", i, ".trans.i2h.bias")), - trans.h2h.weight = mx.symbol.Variable(paste0("l", i, ".trans.h2h.weight")), - trans.h2h.bias = mx.symbol.Variable(paste0("l", i, ".trans.h2h.bias"))) -return (cell) -}) -last.states <- lapply(1:num.gru.layer, function(i) { -state <- list(h=mx.symbol.Variable(paste0("l", i, ".init.h"))) -return (state) -}) - -# embeding layer -label <- mx.symbol.Variable("label") -data <- mx.symbol.Variable("data") -embed <- mx.symbol.Embedding(data=data, input.dim=input.size, - weight=embed.weight, output.dim=num.embed, name='embed') -wordvec <- mx.symbol.SliceChannel(data=embed, num.outputs=seq.len, squeeze.axis=1) - -
[GitHub] yajiedesign commented on issue #8572: use first class cuda with cmake 3.9 and cuda9.0 support
yajiedesign commented on issue #8572: use first class cuda with cmake 3.9 and cuda9.0 support URL: https://github.com/apache/incubator-mxnet/pull/8572#issuecomment-343631038 yes This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rahul003 commented on issue #8578: Add development instructions and update installation instructions
rahul003 commented on issue #8578: Add development instructions and update installation instructions URL: https://github.com/apache/incubator-mxnet/pull/8578#issuecomment-343625788 How much better is it to use cmake+ninja vs make on ubuntu? In terms of speed This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] sxjscience commented on issue #8338: master branch cannot build on centos 7 with cuda-8.0
sxjscience commented on issue #8338: master branch cannot build on centos 7 with cuda-8.0 URL: https://github.com/apache/incubator-mxnet/issues/8338#issuecomment-343627954 @asmushetzel This makes sense to me. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] asmushetzel commented on issue #8338: master branch cannot build on centos 7 with cuda-8.0
asmushetzel commented on issue #8338: master branch cannot build on centos 7 with cuda-8.0 URL: https://github.com/apache/incubator-mxnet/issues/8338#issuecomment-343625693 I suppose this is still about this one: home/hanfeng/zyh/mxnet/mshadow/mshadow/././././cuda/tensor_gpu-inl.cuh(75): error: expression preceding parentheses of apparent call must have (pointer-to-) function type I don't have yet a clear explanation, but some suspicion. The thing that looks most likely to be the problem in this line is the term exp.Eval(y, x) Why? Simply because "exp" is the name of a parameter of the encompassing MapPlanProc() function and it is also the name of an arithmetic function (and you modified exactly this arith function by making it a template). So there are some hints, that this may cause a problem. What could go wrong here? Some ideas: The compiler has to figure out at some point what it will do with exp.Eval(). According to this "https://msdn.microsoft.com/en-us/library/19cbwccf.aspx; there may be the possibility, that "exp" is decided to be a pointer to an external function (i.e. a non-dependent variable) as the function parameter with the same name is a dependent variable (its type is dependent on template parameters). To quote this website: "Nondependent names are looked up according to the usual rules and at the point of definition of the template. These names, being independent of the template arguments, are looked up once for all template specializations". So it could be that the compiler decided one time upfront that "exp.Eval" must be some kind of function pointer and no local variable and then later figures out that this is actually not the case (when it eventually expands the templates). This may be triggered by the fact that the compiler identifies the arithmetic function exp - when analyzing the template MapPlanProc first - as a non-dependent name and so assumes that in "exp.Eval(X,Y)" the "exp" refers to the arithmetic function. At this point, it doesn't perform any analysis of template specializations. So it doesn't figure out that the arithmetic function "exp" has no method "Eval" at all (some compilers may be clever enough, but others may not and nvcc is somewhat "special" anyway). Then later, when it processes the first specialization (instantiation) of template "MapPlanProc", it also will try to instantiate "exp.Eval()". And then figures out that "exp.Eval" is no function or function pointer (in fact that exp.Eval is nowhere defined at all when exp is assumed to be the arithmetic exp) and then bails out (with a not very helpful error message). Your change made "exp" a template. Before it was a non-template function and the compiler could always figure out at the time of analyzing the template definition of MapPlanProc that the "exp" in exp.Eval() can't match that arithmetic function "exp". Now as "exp" is a template, it may not be able to figure that out as there could be some specialization of the "exp" template that actually has an "Eval" member (but specializations are handled after the decision that "exp" is bound to the arithmetic function as this binding results in a preferred matching to a non-dependent name) We certainly can make a philosophical discourse out of that. But I would recommend just to try it out and exchange the parameter "const Plan exp" in MapPlanProc to something like "const Plan plan" and then do plan.Eval() inside and see whether it works. You may ask @zhreshold to try it out as PR8582 is currently failing on exactly this. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rahul003 commented on issue #8578: Add development instructions and update installation instructions
rahul003 commented on issue #8578: Add development instructions and update installation instructions URL: https://github.com/apache/incubator-mxnet/pull/8578#issuecomment-343625788 How much better is it to use cmake+ninja vs make on ubuntu? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] asmushetzel commented on issue #8338: master branch cannot build on centos 7 with cuda-8.0
asmushetzel commented on issue #8338: master branch cannot build on centos 7 with cuda-8.0 URL: https://github.com/apache/incubator-mxnet/issues/8338#issuecomment-343625693 I suppose this is still about this one: home/hanfeng/zyh/mxnet/mshadow/mshadow/././././cuda/tensor_gpu-inl.cuh(75): error: expression preceding parentheses of apparent call must have (pointer-to-) function type I don't have yet a clear explanation, but some suspicion. The thing that looks most likely to be the problem in this line is the term exp.Eval(y, x) Why? Simply because "exp" is the name of a parameter of the encompassing MapPlanProc() function and it is also the name of an arithmetic function (and you modified exactly this arith function by making it a template). So there are some hints, that this may cause a problem. What could go wrong here? Some ideas: The compiler has to figure out at some point what it will do with exp.Eval(). According to this "https://msdn.microsoft.com/en-us/library/19cbwccf.aspx; there may be the possibility, that "exp" is decided to be a pointer to an external function (i.e. a non-dependent variable) as the function parameter with the same name is a dependent variable (its type is dependent on template parameters). To quote this website: "Nondependent names are looked up according to the usual rules and at the point of definition of the template. These names, being independent of the template arguments, are looked up once for all template specializations". So it could be that the compiler decided one time upfront that "exp.Eval" must be some kind of function pointer and no local variable and then later figures out that this is actually not the case (when it eventually expands the templates). This may be triggered by the fact that the compiler identifies the arithmetic function exp - when analyzing the template MapPlanProc first - as a non-dependent name and so assumes that in "exp.Eval(X,Y)" the "exp" refers to the arithmetic function. At this point, it doesn't perform any analysis of template specializations. So it doesn't figure out that the arithmetic function "exp" has no method "Eval" at all (some compilers may be clever enough, but others may not and nvcc is somewhat "special" anyway). Then later, when it processes the first specialization (instantiation) of template "MapPlanProc", it also will try to instantiate "exp.Eval()". And then figures out that "exp.Eval" is no function or function pointer (in fact that exp.Eval is nowhere defined at all when exp is assumed to be the arithmetic exp) and then bails out (with a not very helpful error message). We certainly can make a philosophical discourse out of that. But I would recommend just to try it out and exchange the parameter "const Plan exp" in MapPlanProc to something like "const Plan plan" and then do plan.Eval() inside and see whether it works. You may ask @zhreshold to try it out as PR8582 is currently failing on exactly this. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] mbaijal opened a new pull request #8613: [EXPERIMENT] increasing build timeout to 24hrs
mbaijal opened a new pull request #8613: [EXPERIMENT] increasing build timeout to 24hrs URL: https://github.com/apache/incubator-mxnet/pull/8613 ## Description ## All builds are timing out in the build queue since the number of ubuntu slaves is less. Ideally this timeout is meant for the build time on the executor, but somehow it even times out while a task waits in the queue. ## Checklist ## ### Essentials ### - [ ] Passed code style checking (`make lint`) - [ ] Changes are complete (i.e. I finished coding on this PR) - [ ] All changes have test coverage - [ ] For user-facing API changes, API doc string has been updated. For new C++ functions in header files, their functionalities and arguments are well-documented. - [ ] To my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change ### Changes ### - [ ] Changed Timeout to 1440 minutes = 24hrs ## Comments ## This is temporary until we move to a new CI. mbaijal to monitor if this change helps. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] zhreshold commented on a change in pull request #8603: Contrib operators for object-detection bounding box related stuffs
zhreshold commented on a change in pull request #8603: Contrib operators for object-detection bounding box related stuffs URL: https://github.com/apache/incubator-mxnet/pull/8603#discussion_r150365483 ## File path: src/operator/contrib/bounding_box.cc ## @@ -0,0 +1,194 @@ +/* + * 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 + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + /*! + * Copyright (c) 2017 by Contributors + * \file bounding_box.cc + * \brief Bounding box util functions and operators + * \author Joshua Zhang + */ + +#include "./bounding_box-inl.h" +#include "../elemwise_op_common.h" + +namespace mxnet { +namespace op { +DMLC_REGISTER_PARAMETER(BoxNMSParam); +DMLC_REGISTER_PARAMETER(BoxOverlapParam); +DMLC_REGISTER_PARAMETER(BipartiteMatchingParam); + +NNVM_REGISTER_OP(_contrib_box_nms) +.add_alias("_contrib_box_non_maximum_suppression") +.describe(R"code(Apply non-maximum suppression to input. + +The output will be sorted in descending order according to `score`. Boxes with +overlaps larger than `overlap_thresh` and smaller scores will be removed and +filled with -1, the corresponding position will be recorded for backward propogation. + +During back-propagation, the gradient will be copied to the original +position according to the input index. For positions that have been suppressed, +the in_grad will be assigned 0. +In summary, gradients are sticked to its boxes, will either be moved or discarded +according to its original index in input. + +Input requirements: +1. Input tensor have at least 2 dimensions, (n, k), any higher dims will be regarded +as batch, e.g. (a, b, c, d, n, k) == (a*b*c*d, n, k) +2. n is the number of boxes in each batch +3. k is the width of each box item. + +By default, a box is [id, score, xmin, ymin, xmax, ymax, ...], +additional elements are allowed. +- `id_index`: optional, use -1 to ignore, useful if `force_suppress=False`, which means +we will skip highly overlapped boxes if one is `apple` while the other is `car`. +- `coord_start`: required, default=2, the starting index of the 4 coordinates. +Two formats are supported: + `corner`: [xmin, ymin, xmax, ymax] + `center`: [x, y, width, height] +- `score_index`: required, default=1, box score/confidence. +When two boxes overlap IOU > `overlap_thresh`, the one with smaller score will be suppressed. +- `in_format` and `out_format`: default='corner', specify in/out box formats. + +Examples:: + + x = [[0, 0.5, 0.1, 0.1, 0.2, 0.2], [1, 0.4, 0.1, 0.1, 0.2, 0.2], + [0, 0.3, 0.1, 0.1, 0.14, 0.14], [2, 0.6, 0.5, 0.5, 0.7, 0.8]] + box_nms(x, overlap_thresh=0.1, coord_start=2, score_index=1, id_index=0, + force_suppress=True, in_format='corner', out_typ='corner') = + [[2, 0.6, 0.5, 0.5, 0.7, 0.8], [0, 0.5, 0.1, 0.1, 0.2, 0.2], + [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1]] + out_grad = [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1], [0.2, 0.2, 0.2, 0.2, 0.2, 0.2], + [0.3, 0.3, 0.3, 0.3, 0.3, 0.3], [0.4, 0.4, 0.4, 0.4, 0.4, 0.4]] + # exe.backward + in_grad = [[0.2, 0.2, 0.2, 0.2, 0.2, 0.2], [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], [0.1, 0.1, 0.1, 0.1, 0.1, 0.1]] + +)code" ADD_FILELINE) +.set_num_inputs(1) +.set_num_outputs(2) +.set_attr_parser(ParamParser) +.set_attr("FNumVisibleOutputs", BoxNMSNumVisibleOutputs) +.set_attr("FInferShape", BoxNMSShape) +.set_attr("FInferType", ElemwiseType<1, 2>) +.set_attr("FResourceRequest", + [](const NodeAttrs& attrs) { +return std::vector{ResourceRequest::kTempSpace}; + }) +.set_attr("FCompute", BoxNMSForward) +.set_attr("FGradient", ElemwiseGradUseOut{"_backward_contrib_box_nms"}) +.add_argument("data", "NDArray-or-Symbol", "The input") +.add_arguments(BoxNMSParam::__FIELDS__()); + +NNVM_REGISTER_OP(_backward_contrib_box_nms) +.set_num_inputs(3) +.set_num_outputs(1) +.set_attr_parser(ParamParser) +.set_attr("TIsBackward", true) +.set_attr("FCompute", BoxNMSBackward) +.add_arguments(BoxNMSParam::__FIELDS__()); + +NNVM_REGISTER_OP(_contrib_box_iou) +.describe(R"doc(Bounding box overlap of two arrays. + The overlap is defined as Intersection-over-Union, aka, IOU. + - lhs: (a_1, a_2, ..., a_n, 4) array + - rhs: (b_1, b_2, ..., b_n, 4) array + - output: (a_1, a_2, ..., a_n, b_1, b_2, ...,
[GitHub] szha commented on issue #7431: AttributeError: 'module' object has no attribute 'stack'
szha commented on issue #7431: AttributeError: 'module' object has no attribute 'stack' URL: https://github.com/apache/incubator-mxnet/issues/7431#issuecomment-343621970 This issue is closed due to lack of activity in the last 90 days. Feel free to ping me to reopen if this is still an active issue. Thanks! Also, do please check out our [forum](https://discuss.mxnet.io/) (and [Chinese version](https://discuss.gluon.ai/)) for general "how-to" questions. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] szha commented on issue #4696: run errors
szha commented on issue #4696: run errors URL: https://github.com/apache/incubator-mxnet/issues/4696#issuecomment-343621976 This issue is closed due to lack of activity in the last 90 days. Feel free to ping me to reopen if this is still an active issue. Thanks! Also, do please check out our [forum](https://discuss.mxnet.io/) (and [Chinese version](https://discuss.gluon.ai/)) for general "how-to" questions. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] szha closed issue #4696: run errors
szha closed issue #4696: run errors URL: https://github.com/apache/incubator-mxnet/issues/4696 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] szha commented on issue #7384: Parameter 'dtype' in the function 'ImageRecordIter' doesn't work
szha commented on issue #7384: Parameter 'dtype' in the function 'ImageRecordIter' doesn't work URL: https://github.com/apache/incubator-mxnet/issues/7384#issuecomment-343621973 This issue is closed due to lack of activity in the last 90 days. Feel free to ping me to reopen if this is still an active issue. Thanks! Also, do please check out our [forum](https://discuss.mxnet.io/) (and [Chinese version](https://discuss.gluon.ai/)) for general "how-to" questions. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] szha closed issue #7431: AttributeError: 'module' object has no attribute 'stack'
szha closed issue #7431: AttributeError: 'module' object has no attribute 'stack' URL: https://github.com/apache/incubator-mxnet/issues/7431 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] szha closed issue #7384: Parameter 'dtype' in the function 'ImageRecordIter' doesn't work
szha closed issue #7384: Parameter 'dtype' in the function 'ImageRecordIter' doesn't work URL: https://github.com/apache/incubator-mxnet/issues/7384 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[incubator-mxnet] branch master updated: Fix for "name epochs is not defined" (#8399)
This is an automated email from the ASF dual-hosted git repository. jxie 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 582e14c Fix for "name epochs is not defined" (#8399) 582e14c is described below commit 582e14c9b079092e2eadf7390497b821546e7344 Author: Przemyslaw TredakAuthorDate: Fri Nov 10 16:02:10 2017 -0800 Fix for "name epochs is not defined" (#8399) --- example/gluon/image_classification.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/gluon/image_classification.py b/example/gluon/image_classification.py index a67da35..a2fb757 100644 --- a/example/gluon/image_classification.py +++ b/example/gluon/image_classification.py @@ -184,7 +184,7 @@ def main(): optimizer = 'sgd', optimizer_params = {'learning_rate': opt.lr, 'wd': opt.wd, 'momentum': opt.momentum}, initializer = mx.init.Xavier(magnitude=2)) -mod.save_params('image-classifier-%s-%d-final.params'%(opt.model, epochs)) +mod.save_params('image-classifier-%s-%d-final.params'%(opt.model, opt.epochs)) else: if opt.mode == 'hybrid': net.hybridize() -- To stop receiving notification emails like this one, please contact ['"comm...@mxnet.apache.org" '].
[GitHub] piiswrong closed pull request #8399: Fix for "name epochs is not defined"
piiswrong closed pull request #8399: Fix for "name epochs is not defined" URL: https://github.com/apache/incubator-mxnet/pull/8399 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/example/gluon/image_classification.py b/example/gluon/image_classification.py index a67da35341..a2fb757683 100644 --- a/example/gluon/image_classification.py +++ b/example/gluon/image_classification.py @@ -184,7 +184,7 @@ def main(): optimizer = 'sgd', optimizer_params = {'learning_rate': opt.lr, 'wd': opt.wd, 'momentum': opt.momentum}, initializer = mx.init.Xavier(magnitude=2)) -mod.save_params('image-classifier-%s-%d-final.params'%(opt.model, epochs)) +mod.save_params('image-classifier-%s-%d-final.params'%(opt.model, opt.epochs)) else: if opt.mode == 'hybrid': net.hybridize() This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] piiswrong commented on issue #8610: How to resize the image to same shape in ImageRecordIter?
piiswrong commented on issue #8610: How to resize the image to same shape in ImageRecordIter? URL: https://github.com/apache/incubator-mxnet/issues/8610#issuecomment-343618547 imagerecorditer has a resize parameter. Use it to resize the image to a bigger size then crop size first This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] sxjscience commented on a change in pull request #8603: Contrib operators for object-detection bounding box related stuffs
sxjscience commented on a change in pull request #8603: Contrib operators for object-detection bounding box related stuffs URL: https://github.com/apache/incubator-mxnet/pull/8603#discussion_r150362562 ## File path: src/operator/contrib/bounding_box-inl.h ## @@ -0,0 +1,730 @@ +/* + * 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 + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file bounding_box-inl.h + * \brief bounding box util functions and operators + * \author Joshua Zhang +*/ +#ifndef MXNET_OPERATOR_CONTRIB_BOUNDING_BOX_INL_H_ +#define MXNET_OPERATOR_CONTRIB_BOUNDING_BOX_INL_H_ +#include +#include +#include +#include +#include +#include +#include +#include "../mshadow_op.h" +#include "../mxnet_op.h" +#include "../operator_common.h" +#include "../tensor/sort_op.h" + +namespace mxnet { +namespace op { +namespace box_common_enum { +enum BoxType {kCorner, kCenter}; +} +namespace box_nms_enum { +enum BoxNMSOpInputs {kData}; +enum BoxNMSOpOutputs {kOut, kTemp}; +enum BoxNMSOpResource {kTempSpace}; +} // box_nms_enum + +struct BoxNMSParam : public dmlc::Parameter { + float overlap_thresh; + int topk; + int coord_start; + int score_index; + int id_index; + bool force_suppress; + int in_format; + int out_format; + DMLC_DECLARE_PARAMETER(BoxNMSParam) { +DMLC_DECLARE_FIELD(overlap_thresh).set_default(0.5) +.describe("Overlapping(IoU) threshold to suppress object with smaller score."); +DMLC_DECLARE_FIELD(topk).set_default(-1) +.describe("Apply nms to topk boxes with descending scores, -1 to no restriction."); +DMLC_DECLARE_FIELD(coord_start).set_default(2) +.describe("Start index of the consecutive 4 coordinates."); +DMLC_DECLARE_FIELD(score_index).set_default(1) +.describe("Index of the scores/confidence of boxes."); +DMLC_DECLARE_FIELD(id_index).set_default(-1) +.describe("Optional, index of the class categories, -1 to disable."); +DMLC_DECLARE_FIELD(force_suppress).set_default(false) +.describe("Optional, if set false and id_index is provided, nms will only apply" +" to boxes belongs to the same category"); +DMLC_DECLARE_FIELD(in_format).set_default(box_common_enum::kCorner) +.add_enum("corner", box_common_enum::kCorner) +.add_enum("center", box_common_enum::kCenter) +.describe("The input box encoding type. \n" +" \"corner\" means boxes are encoded as [xmin, ymin, xmax, ymax]," +" \"center\" means boxes are encodes as [x, y, width, height]."); +DMLC_DECLARE_FIELD(out_format).set_default(box_common_enum::kCorner) +.add_enum("corner", box_common_enum::kCorner) +.add_enum("center", box_common_enum::kCenter) +.describe("The output box encoding type. \n" +" \"corner\" means boxes are encoded as [xmin, ymin, xmax, ymax]," +" \"center\" means boxes are encodes as [x, y, width, height]."); + } +}; // BoxNMSParam + +inline bool BoxNMSShape(const nnvm::NodeAttrs& attrs, + std::vector *in_attrs, + std::vector *out_attrs) { + const BoxNMSParam& param = nnvm::get(attrs.parsed); + CHECK_EQ(in_attrs->size(), 1U); + CHECK_EQ(out_attrs->size(), 2U); + if (in_attrs->at(0).ndim() == 0U && out_attrs->at(0).ndim() == 0U) { +return false; + } + + TShape& ishape = (*in_attrs)[0]; + int indim = ishape.ndim(); + CHECK(indim >= 2) +<< "input must have dim >= 2" +<< " the last two dimensions are num_box and box_width " +<< ishape << " provided"; + int width_elem = ishape[indim - 1]; + int expected = 5; + if (param.id_index > 0) { +expected += 1; + } + CHECK_GE(width_elem, expected) +<< "the last dimension must have at least 5 elements" +<< " namely (score, coordinates x 4) " +<< width_elem << " provided, " << expected << " expected."; + // check indices + int coord_start = param.coord_start; + int coord_end = param.coord_start + 3; + int score_index = param.score_index; + CHECK(score_index >= 0 && score_index < width_elem) +<< "score_index: " << score_index << " out of range: (0, " +<< width_elem << ")"; + CHECK(score_index < coord_start || score_index > coord_end) +<< "score_index: " << score_index << " conflict with coordinates: (" +
[GitHub] zhreshold commented on a change in pull request #8603: Contrib operators for object-detection bounding box related stuffs
zhreshold commented on a change in pull request #8603: Contrib operators for object-detection bounding box related stuffs URL: https://github.com/apache/incubator-mxnet/pull/8603#discussion_r150362100 ## File path: src/operator/contrib/bounding_box-inl.h ## @@ -0,0 +1,730 @@ +/* + * 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 + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file bounding_box-inl.h + * \brief bounding box util functions and operators + * \author Joshua Zhang +*/ +#ifndef MXNET_OPERATOR_CONTRIB_BOUNDING_BOX_INL_H_ +#define MXNET_OPERATOR_CONTRIB_BOUNDING_BOX_INL_H_ +#include +#include +#include +#include +#include +#include +#include +#include "../mshadow_op.h" +#include "../mxnet_op.h" +#include "../operator_common.h" +#include "../tensor/sort_op.h" + +namespace mxnet { +namespace op { +namespace box_common_enum { +enum BoxType {kCorner, kCenter}; +} +namespace box_nms_enum { +enum BoxNMSOpInputs {kData}; +enum BoxNMSOpOutputs {kOut, kTemp}; +enum BoxNMSOpResource {kTempSpace}; +} // box_nms_enum + +struct BoxNMSParam : public dmlc::Parameter { + float overlap_thresh; + int topk; + int coord_start; + int score_index; + int id_index; + bool force_suppress; + int in_format; + int out_format; + DMLC_DECLARE_PARAMETER(BoxNMSParam) { +DMLC_DECLARE_FIELD(overlap_thresh).set_default(0.5) +.describe("Overlapping(IoU) threshold to suppress object with smaller score."); +DMLC_DECLARE_FIELD(topk).set_default(-1) +.describe("Apply nms to topk boxes with descending scores, -1 to no restriction."); +DMLC_DECLARE_FIELD(coord_start).set_default(2) +.describe("Start index of the consecutive 4 coordinates."); +DMLC_DECLARE_FIELD(score_index).set_default(1) +.describe("Index of the scores/confidence of boxes."); +DMLC_DECLARE_FIELD(id_index).set_default(-1) +.describe("Optional, index of the class categories, -1 to disable."); +DMLC_DECLARE_FIELD(force_suppress).set_default(false) +.describe("Optional, if set false and id_index is provided, nms will only apply" +" to boxes belongs to the same category"); +DMLC_DECLARE_FIELD(in_format).set_default(box_common_enum::kCorner) +.add_enum("corner", box_common_enum::kCorner) +.add_enum("center", box_common_enum::kCenter) +.describe("The input box encoding type. \n" +" \"corner\" means boxes are encoded as [xmin, ymin, xmax, ymax]," +" \"center\" means boxes are encodes as [x, y, width, height]."); +DMLC_DECLARE_FIELD(out_format).set_default(box_common_enum::kCorner) +.add_enum("corner", box_common_enum::kCorner) +.add_enum("center", box_common_enum::kCenter) +.describe("The output box encoding type. \n" +" \"corner\" means boxes are encoded as [xmin, ymin, xmax, ymax]," +" \"center\" means boxes are encodes as [x, y, width, height]."); + } +}; // BoxNMSParam + +inline bool BoxNMSShape(const nnvm::NodeAttrs& attrs, + std::vector *in_attrs, + std::vector *out_attrs) { + const BoxNMSParam& param = nnvm::get(attrs.parsed); + CHECK_EQ(in_attrs->size(), 1U); + CHECK_EQ(out_attrs->size(), 2U); + if (in_attrs->at(0).ndim() == 0U && out_attrs->at(0).ndim() == 0U) { +return false; + } + + TShape& ishape = (*in_attrs)[0]; + int indim = ishape.ndim(); + CHECK(indim >= 2) +<< "input must have dim >= 2" +<< " the last two dimensions are num_box and box_width " +<< ishape << " provided"; + int width_elem = ishape[indim - 1]; + int expected = 5; + if (param.id_index > 0) { +expected += 1; + } + CHECK_GE(width_elem, expected) +<< "the last dimension must have at least 5 elements" +<< " namely (score, coordinates x 4) " +<< width_elem << " provided, " << expected << " expected."; + // check indices + int coord_start = param.coord_start; + int coord_end = param.coord_start + 3; + int score_index = param.score_index; + CHECK(score_index >= 0 && score_index < width_elem) +<< "score_index: " << score_index << " out of range: (0, " +<< width_elem << ")"; + CHECK(score_index < coord_start || score_index > coord_end) +<< "score_index: " << score_index << " conflict with coordinates: (" +<<
[GitHub] piiswrong commented on issue #8259: check_format of sparse ndrray
piiswrong commented on issue #8259: check_format of sparse ndrray URL: https://github.com/apache/incubator-mxnet/pull/8259#issuecomment-343615517 How is the check result returned? Is the behavior consistent with scipy? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] piiswrong commented on a change in pull request #8259: check_format of sparse ndrray
piiswrong commented on a change in pull request #8259: check_format of sparse ndrray URL: https://github.com/apache/incubator-mxnet/pull/8259#discussion_r150360872 ## File path: src/common/utils.h ## @@ -43,9 +43,177 @@ #include #include +#include "../operator/mxnet_op.h" + namespace mxnet { namespace common { + +/*! + * \brief IndPtr should be non-negative, in non-decreasing order, start with 0 + * and end with value equal with size of indices. + */ +struct csr_indptr_check { + template + MSHADOW_XINLINE static void Map(int i, DType* out, const IType* indptr, + const nnvm::dim_t end, const nnvm::dim_t idx_size) { +if (indptr[i+1] < 0 || indptr[i+1] < indptr[i] || +(i == 0 && indptr[i] != 0) || +(i == end - 1 && indptr[end] != idx_size)) + *out = kCSRIndPtrErr; + } +}; + +/*! + * \brief Indices should be non-negative, less than the number of columns + * and in ascending order per row. + */ +struct csr_idx_check { + template + MSHADOW_XINLINE static void Map(int i, DType* out, const IType* idx, + const RType* indptr, const nnvm::dim_t ncols) { +for (RType j = indptr[i]; j < indptr[i+1]; j++) { + if (idx[j] >= ncols || idx[j] < 0 || + (j < indptr[i+1] - 1 && idx[j] >= idx[j+1])) { +*out = kCSRIdxErr; +break; + } +} + } +}; + +/*! + * \brief Indices of RSPNDArray should be non-negative, + * less than the size of first dimension and in ascending order + */ +struct rsp_idx_check { + template + MSHADOW_XINLINE static void Map(int i, DType* out, const IType* idx, + const nnvm::dim_t end, const nnvm::dim_t nrows) { +if ((i < end && idx[i+1] <= idx[i]) +|| idx[i] < 0 || idx[i] >= nrows) + *out = kRSPIdxErr; + } +}; + +template +void CheckFormatWrapper(const RunContext , const NDArray , +const TBlob _cpu, const bool full_check); + +/*! + * \brief Check the validity of CSRNDArray. + * \param rctx Execution context. + * \param input Input NDArray of CSRStorage. + * \param err_cpu Error number on cpu. + * \param full_check If true, rigorous check, O(N) operations, + * otherwise basic check, O(1) operations. + */ +template +void CheckFormatCSRImpl(const RunContext , const NDArray , +const TBlob _cpu, const bool full_check) { + using namespace op::mxnet_op; + CHECK_EQ(input.storage_type(), kCSRStorage) + << "CheckFormatCSRImpl is for CSRNDArray"; + const TShape shape = input.shape(); + const TShape idx_shape = input.aux_shape(csr::kIdx); + const TShape indptr_shape = input.aux_shape(csr::kIndPtr); + const TShape storage_shape = input.storage_shape(); + if ((shape.ndim() != 2) || + (idx_shape.ndim() != 1 || indptr_shape.ndim() != 1 || storage_shape.ndim() != 1) || + (indptr_shape[0] != shape[0] + 1) || + (idx_shape[0] != storage_shape[0])) { + MSHADOW_TYPE_SWITCH(err_cpu.type_flag_, DType, { + DType* err = err_cpu.dptr(); + *err = kCSRShapeErr; + }); + return; + } + if (full_check) { +MSHADOW_TYPE_SWITCH(err_cpu.type_flag_, DType, { + MSHADOW_IDX_TYPE_SWITCH(input.aux_type(csr::kIndPtr), RType, { +MSHADOW_IDX_TYPE_SWITCH(input.aux_type(csr::kIdx), IType, { + mshadow::Stream *s = rctx.get_stream(); + NDArray ret_xpu = NDArray(mshadow::Shape1(1), +rctx.get_ctx(), false, err_cpu.type_flag_); + TBlob val_xpu = ret_xpu.data(); + Kernel::Launch(s, val_xpu.Size(), val_xpu.dptr()); Review comment: So the whole array is set to kNormalErr? Is this what scipy does? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[incubator-mxnet] branch master updated: support for lapack functions with mkl (#8577)
This is an automated email from the ASF dual-hosted git repository. jxie 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 00ddcf4 support for lapack functions with mkl (#8577) 00ddcf4 is described below commit 00ddcf44299a1f88c8d6448f30cf002c8942a2fa Author: moinAuthorDate: Sat Nov 11 00:37:17 2017 +0100 support for lapack functions with mkl (#8577) --- make/config.mk | 6 make/osx.mk | 6 src/operator/c_lapack_api.h | 81 ++--- src/operator/linalg_impl.h | 22 ++-- 4 files changed, 100 insertions(+), 15 deletions(-) diff --git a/make/config.mk b/make/config.mk index d47d4d6..a4774f0 100644 --- a/make/config.mk +++ b/make/config.mk @@ -105,6 +105,12 @@ USE_LAPACK = 1 # path to lapack library in case of a non-standard installation USE_LAPACK_PATH = +# by default, disable lapack when using MKL +# switch on when there is a full installation of MKL available (not just MKL2017/MKL_ML) +ifeq ($(USE_BLAS), mkl) +USE_LAPACK = 0 +endif + # add path to intel library, you may need it for MKL, if you did not add the path # to environment variable USE_INTEL_PATH = NONE diff --git a/make/osx.mk b/make/osx.mk index d9ce6f2..b17b04c 100644 --- a/make/osx.mk +++ b/make/osx.mk @@ -67,6 +67,12 @@ USE_BLAS = apple # only effective when compiled with blas versions openblas/apple/atlas/mkl USE_LAPACK = 1 +# by default, disable lapack when using MKL +# switch on when there is a full installation of MKL available (not just MKL2017/MKL_ML) +ifeq ($(USE_BLAS), mkl) +USE_LAPACK = 0 +endif + # add path to intel library, you may need it for MKL, if you did not add the path # to environment variable USE_INTEL_PATH = NONE diff --git a/src/operator/c_lapack_api.h b/src/operator/c_lapack_api.h index 53b0bf2..293c3f2 100644 --- a/src/operator/c_lapack_api.h +++ b/src/operator/c_lapack_api.h @@ -70,6 +70,9 @@ using namespace mshadow; +// Will cause clash with MKL fortran layer headers +#if MSHADOW_USE_MKL == 0 + extern "C" { // Fortran signatures @@ -118,15 +121,14 @@ extern "C" { MXNET_LAPACK_FSIG_SYEVD(dsyevd, double) } -#define MXNET_LAPACK_ROW_MAJOR 101 -#define MXNET_LAPACK_COL_MAJOR 102 +#endif // MSHADOW_USE_MKL == 0 + #define CHECK_LAPACK_UPLO(a) \ CHECK(a == 'U' || a == 'L') << "neither L nor U specified as triangle in lapack call"; inline char loup(char uplo, bool invert) { return invert ? (uplo == 'U' ? 'L' : 'U') : uplo; } - /*! * \brief Transpose matrix data in memory * @@ -160,7 +162,75 @@ inline void flip (int m, int n, } -#if MXNET_USE_LAPACK +#if (MSHADOW_USE_MKL && MXNET_USE_LAPACK) + + // We interface with the C-interface of MKL + // as this is the preferred way. + #include + + #define MXNET_LAPACK_ROW_MAJOR LAPACK_ROW_MAJOR + #define MXNET_LAPACK_COL_MAJOR LAPACK_COL_MAJOR + + // These function have already matching signature. + #define MXNET_LAPACK_spotrf LAPACKE_spotrf + #define MXNET_LAPACK_dpotrf LAPACKE_dpotrf + #define MXNET_LAPACK_spotri LAPACKE_spotri + #define MXNET_LAPACK_dpotri LAPACKE_dpotri + #define mxnet_lapack_sposv LAPACKE_sposv + #define mxnet_lapack_dposv LAPACKE_dposv + + // The following functions differ in signature from the + // MXNET_LAPACK-signature and have to be wrapped. + #define MXNET_LAPACK_CWRAP_GELQF(prefix, dtype) \ + inline int MXNET_LAPACK_##prefix##gelqf(int matrix_layout, int m, int n, \ + dtype *a, int lda, dtype* tau, \ + dtype* work, int lwork) { \ +if (lwork != -1) { \ + return LAPACKE_##prefix##gelqf(matrix_layout, m, n, a, lda, tau); \ +} \ +*work = 0; \ +return 0; \ + } + MXNET_LAPACK_CWRAP_GELQF(s, float) + MXNET_LAPACK_CWRAP_GELQF(d, double) + + #define MXNET_LAPACK_CWRAP_ORGLQ(prefix, dtype) \ + inline int MXNET_LAPACK_##prefix##orglq(int matrix_layout, int m, int n, \ + dtype *a, int lda, dtype* tau, \ + dtype* work, int lwork) { \ +if (lwork != -1) { \ + return LAPACKE_##prefix##orglq(matrix_layout, m, n, m, a, lda, tau); \ +} \ +*work = 0; \ +return 0; \ + } + MXNET_LAPACK_CWRAP_ORGLQ(s, float) + MXNET_LAPACK_CWRAP_ORGLQ(d, double) + + // This has to be called internally in COL_MAJOR format even when matrix_layout + // is row-major as otherwise the eigenvectors would be returned as cols in a + // row-major matrix layout (see MKL documentation). + // We also have to allocate at least one DType element as workspace as the + // calling code assumes that the workspace has at least that size. + #define MXNET_LAPACK_CWRAP_SYEVD(prefix, dtype) \ + inline int MXNET_LAPACK_##prefix##syevd(int matrix_layout, char uplo,
[GitHub] piiswrong commented on a change in pull request #8577: support for lapack functions with mkl
piiswrong commented on a change in pull request #8577: support for lapack functions with mkl URL: https://github.com/apache/incubator-mxnet/pull/8577#discussion_r150360534 ## File path: src/operator/c_lapack_api.h ## @@ -160,7 +162,75 @@ inline void flip(int m, int n, } -#if MXNET_USE_LAPACK +#if (MSHADOW_USE_MKL && MXNET_USE_LAPACK) + + // We interface with the C-interface of MKL + // as this is the preferred way. + #include + + #define MXNET_LAPACK_ROW_MAJOR LAPACK_ROW_MAJOR + #define MXNET_LAPACK_COL_MAJOR LAPACK_COL_MAJOR + + // These function have already matching signature. + #define MXNET_LAPACK_spotrf LAPACKE_spotrf + #define MXNET_LAPACK_dpotrf LAPACKE_dpotrf + #define MXNET_LAPACK_spotri LAPACKE_spotri + #define MXNET_LAPACK_dpotri LAPACKE_dpotri + #define mxnet_lapack_sposv LAPACKE_sposv + #define mxnet_lapack_dposv LAPACKE_dposv + + // The following functions differ in signature from the + // MXNET_LAPACK-signature and have to be wrapped. + #define MXNET_LAPACK_CWRAP_GELQF(prefix, dtype) \ + inline int MXNET_LAPACK_##prefix##gelqf(int matrix_layout, int m, int n, \ + dtype *a, int lda, dtype* tau, \ + dtype* work, int lwork) { \ +if (lwork != -1) { \ + return LAPACKE_##prefix##gelqf(matrix_layout, m, n, a, lda, tau); \ +} \ +*work = 0; \ +return 0; \ + } + MXNET_LAPACK_CWRAP_GELQF(s, float) + MXNET_LAPACK_CWRAP_GELQF(d, double) + + #define MXNET_LAPACK_CWRAP_ORGLQ(prefix, dtype) \ + inline int MXNET_LAPACK_##prefix##orglq(int matrix_layout, int m, int n, \ + dtype *a, int lda, dtype* tau, \ + dtype* work, int lwork) { \ +if (lwork != -1) { \ + return LAPACKE_##prefix##orglq(matrix_layout, m, n, m, a, lda, tau); \ +} \ +*work = 0; \ +return 0; \ + } + MXNET_LAPACK_CWRAP_ORGLQ(s, float) + MXNET_LAPACK_CWRAP_ORGLQ(d, double) + + // This has to be called internally in COL_MAJOR format even when matrix_layout + // is row-major as otherwise the eigenvectors would be returned as cols in a + // row-major matrix layout (see MKL documentation). + // We also have to allocate at least one DType element as workspace as the + // calling code assumes that the workspace has at least that size. + #define MXNET_LAPACK_CWRAP_SYEVD(prefix, dtype) \ + inline int MXNET_LAPACK_##prefix##syevd(int matrix_layout, char uplo, int n, dtype *a, \ Review comment: yeah I think that would make more sense. Since this is backend code it should be fine. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] piiswrong closed pull request #8577: support for lapack functions with mkl
piiswrong closed pull request #8577: support for lapack functions with mkl URL: https://github.com/apache/incubator-mxnet/pull/8577 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/make/config.mk b/make/config.mk index d47d4d6931..a4774f0da8 100644 --- a/make/config.mk +++ b/make/config.mk @@ -105,6 +105,12 @@ USE_LAPACK = 1 # path to lapack library in case of a non-standard installation USE_LAPACK_PATH = +# by default, disable lapack when using MKL +# switch on when there is a full installation of MKL available (not just MKL2017/MKL_ML) +ifeq ($(USE_BLAS), mkl) +USE_LAPACK = 0 +endif + # add path to intel library, you may need it for MKL, if you did not add the path # to environment variable USE_INTEL_PATH = NONE diff --git a/make/osx.mk b/make/osx.mk index d9ce6f2df8..b17b04cfdb 100644 --- a/make/osx.mk +++ b/make/osx.mk @@ -67,6 +67,12 @@ USE_BLAS = apple # only effective when compiled with blas versions openblas/apple/atlas/mkl USE_LAPACK = 1 +# by default, disable lapack when using MKL +# switch on when there is a full installation of MKL available (not just MKL2017/MKL_ML) +ifeq ($(USE_BLAS), mkl) +USE_LAPACK = 0 +endif + # add path to intel library, you may need it for MKL, if you did not add the path # to environment variable USE_INTEL_PATH = NONE diff --git a/src/operator/c_lapack_api.h b/src/operator/c_lapack_api.h index 53b0bf258a..293c3f2f81 100644 --- a/src/operator/c_lapack_api.h +++ b/src/operator/c_lapack_api.h @@ -70,6 +70,9 @@ using namespace mshadow; +// Will cause clash with MKL fortran layer headers +#if MSHADOW_USE_MKL == 0 + extern "C" { // Fortran signatures @@ -118,15 +121,14 @@ extern "C" { MXNET_LAPACK_FSIG_SYEVD(dsyevd, double) } -#define MXNET_LAPACK_ROW_MAJOR 101 -#define MXNET_LAPACK_COL_MAJOR 102 +#endif // MSHADOW_USE_MKL == 0 + #define CHECK_LAPACK_UPLO(a) \ CHECK(a == 'U' || a == 'L') << "neither L nor U specified as triangle in lapack call"; inline char loup(char uplo, bool invert) { return invert ? (uplo == 'U' ? 'L' : 'U') : uplo; } - /*! * \brief Transpose matrix data in memory * @@ -160,7 +162,75 @@ inline void flip(int m, int n, } -#if MXNET_USE_LAPACK +#if (MSHADOW_USE_MKL && MXNET_USE_LAPACK) + + // We interface with the C-interface of MKL + // as this is the preferred way. + #include + + #define MXNET_LAPACK_ROW_MAJOR LAPACK_ROW_MAJOR + #define MXNET_LAPACK_COL_MAJOR LAPACK_COL_MAJOR + + // These function have already matching signature. + #define MXNET_LAPACK_spotrf LAPACKE_spotrf + #define MXNET_LAPACK_dpotrf LAPACKE_dpotrf + #define MXNET_LAPACK_spotri LAPACKE_spotri + #define MXNET_LAPACK_dpotri LAPACKE_dpotri + #define mxnet_lapack_sposv LAPACKE_sposv + #define mxnet_lapack_dposv LAPACKE_dposv + + // The following functions differ in signature from the + // MXNET_LAPACK-signature and have to be wrapped. + #define MXNET_LAPACK_CWRAP_GELQF(prefix, dtype) \ + inline int MXNET_LAPACK_##prefix##gelqf(int matrix_layout, int m, int n, \ + dtype *a, int lda, dtype* tau, \ + dtype* work, int lwork) { \ +if (lwork != -1) { \ + return LAPACKE_##prefix##gelqf(matrix_layout, m, n, a, lda, tau); \ +} \ +*work = 0; \ +return 0; \ + } + MXNET_LAPACK_CWRAP_GELQF(s, float) + MXNET_LAPACK_CWRAP_GELQF(d, double) + + #define MXNET_LAPACK_CWRAP_ORGLQ(prefix, dtype) \ + inline int MXNET_LAPACK_##prefix##orglq(int matrix_layout, int m, int n, \ + dtype *a, int lda, dtype* tau, \ + dtype* work, int lwork) { \ +if (lwork != -1) { \ + return LAPACKE_##prefix##orglq(matrix_layout, m, n, m, a, lda, tau); \ +} \ +*work = 0; \ +return 0; \ + } + MXNET_LAPACK_CWRAP_ORGLQ(s, float) + MXNET_LAPACK_CWRAP_ORGLQ(d, double) + + // This has to be called internally in COL_MAJOR format even when matrix_layout + // is row-major as otherwise the eigenvectors would be returned as cols in a + // row-major matrix layout (see MKL documentation). + // We also have to allocate at least one DType element as workspace as the + // calling code assumes that the workspace has at least that size. + #define MXNET_LAPACK_CWRAP_SYEVD(prefix, dtype) \ + inline int MXNET_LAPACK_##prefix##syevd(int matrix_layout, char uplo, int n, dtype *a, \ + int lda, dtype *w, dtype *work, int lwork, \ + int *iwork, int liwork) { \ +if (lwork != -1) { \ + char o(loup(uplo, (matrix_layout == MXNET_LAPACK_ROW_MAJOR))); \ + return LAPACKE_##prefix##syevd(LAPACK_COL_MAJOR, 'V', o, n, a, lda, w);
[GitHub] jeremiedb commented on issue #8545: Incorrect results from R 3.4.2 in MNIST
jeremiedb commented on issue #8545: Incorrect results from R 3.4.2 in MNIST URL: https://github.com/apache/incubator-mxnet/issues/8545#issuecomment-343611371 Yes #8121 will fix this problem. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] jeremiedb commented on a change in pull request #8121: [R] Initializer fix and adjustments to RNN API
jeremiedb commented on a change in pull request #8121: [R] Initializer fix and adjustments to RNN API URL: https://github.com/apache/incubator-mxnet/pull/8121#discussion_r150357674 ## File path: R-package/R/initializer.R ## @@ -4,11 +4,11 @@ #' @param shape the shape of the array to be generated. #' mx.init.internal.default <- function(name, shape, ctx, allow.unknown=FALSE) { - if (endsWith(name, "bias")) return (mx.nd.zeros(shape, ctx)) - if (endsWith(name, "gamma")) return (mx.nd.ones(shape, ctx)) - if (endsWith(name, "beta")) return (mx.nd.zeros(shape, ctx)) - if (endsWith(name, "moving_mean")) return (mx.nd.zeros(shape, ctx)) - if (endsWith(name, "moving_var")) return (mx.nd.ones(shape, ctx)) + if (endsWith(name, "bias")) return (mx.nd.zeros(shape)) Review comment: Reason is that mx.nd.normal wasn't supported on GPU, at least when I did the test, so I made a hotfix to avoid cases when initialization would be attempted on GPU. I can validate whether the operator is now working. Or just assume it will eventually and bring back the ctx in the parameter. Anyway, it guess it's unlikely to call the initializer in another context than cpu. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] sxjscience commented on a change in pull request #8603: Contrib operators for object-detection bounding box related stuffs
sxjscience commented on a change in pull request #8603: Contrib operators for object-detection bounding box related stuffs URL: https://github.com/apache/incubator-mxnet/pull/8603#discussion_r150357652 ## File path: src/operator/contrib/bounding_box-inl.h ## @@ -0,0 +1,730 @@ +/* + * 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 + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * \file bounding_box-inl.h + * \brief bounding box util functions and operators + * \author Joshua Zhang +*/ +#ifndef MXNET_OPERATOR_CONTRIB_BOUNDING_BOX_INL_H_ +#define MXNET_OPERATOR_CONTRIB_BOUNDING_BOX_INL_H_ +#include +#include +#include +#include +#include +#include +#include +#include "../mshadow_op.h" +#include "../mxnet_op.h" +#include "../operator_common.h" +#include "../tensor/sort_op.h" + +namespace mxnet { +namespace op { +namespace box_common_enum { +enum BoxType {kCorner, kCenter}; +} +namespace box_nms_enum { +enum BoxNMSOpInputs {kData}; +enum BoxNMSOpOutputs {kOut, kTemp}; +enum BoxNMSOpResource {kTempSpace}; +} // box_nms_enum + +struct BoxNMSParam : public dmlc::Parameter { + float overlap_thresh; + int topk; + int coord_start; + int score_index; + int id_index; + bool force_suppress; + int in_format; + int out_format; + DMLC_DECLARE_PARAMETER(BoxNMSParam) { +DMLC_DECLARE_FIELD(overlap_thresh).set_default(0.5) +.describe("Overlapping(IoU) threshold to suppress object with smaller score."); +DMLC_DECLARE_FIELD(topk).set_default(-1) +.describe("Apply nms to topk boxes with descending scores, -1 to no restriction."); +DMLC_DECLARE_FIELD(coord_start).set_default(2) +.describe("Start index of the consecutive 4 coordinates."); +DMLC_DECLARE_FIELD(score_index).set_default(1) +.describe("Index of the scores/confidence of boxes."); +DMLC_DECLARE_FIELD(id_index).set_default(-1) +.describe("Optional, index of the class categories, -1 to disable."); +DMLC_DECLARE_FIELD(force_suppress).set_default(false) +.describe("Optional, if set false and id_index is provided, nms will only apply" +" to boxes belongs to the same category"); +DMLC_DECLARE_FIELD(in_format).set_default(box_common_enum::kCorner) +.add_enum("corner", box_common_enum::kCorner) +.add_enum("center", box_common_enum::kCenter) +.describe("The input box encoding type. \n" +" \"corner\" means boxes are encoded as [xmin, ymin, xmax, ymax]," +" \"center\" means boxes are encodes as [x, y, width, height]."); +DMLC_DECLARE_FIELD(out_format).set_default(box_common_enum::kCorner) +.add_enum("corner", box_common_enum::kCorner) +.add_enum("center", box_common_enum::kCenter) +.describe("The output box encoding type. \n" +" \"corner\" means boxes are encoded as [xmin, ymin, xmax, ymax]," +" \"center\" means boxes are encodes as [x, y, width, height]."); + } +}; // BoxNMSParam + +inline bool BoxNMSShape(const nnvm::NodeAttrs& attrs, + std::vector *in_attrs, + std::vector *out_attrs) { + const BoxNMSParam& param = nnvm::get(attrs.parsed); + CHECK_EQ(in_attrs->size(), 1U); + CHECK_EQ(out_attrs->size(), 2U); + if (in_attrs->at(0).ndim() == 0U && out_attrs->at(0).ndim() == 0U) { +return false; + } + + TShape& ishape = (*in_attrs)[0]; + int indim = ishape.ndim(); + CHECK(indim >= 2) +<< "input must have dim >= 2" +<< " the last two dimensions are num_box and box_width " +<< ishape << " provided"; + int width_elem = ishape[indim - 1]; + int expected = 5; + if (param.id_index > 0) { +expected += 1; + } + CHECK_GE(width_elem, expected) +<< "the last dimension must have at least 5 elements" +<< " namely (score, coordinates x 4) " +<< width_elem << " provided, " << expected << " expected."; + // check indices + int coord_start = param.coord_start; + int coord_end = param.coord_start + 3; + int score_index = param.score_index; + CHECK(score_index >= 0 && score_index < width_elem) +<< "score_index: " << score_index << " out of range: (0, " +<< width_elem << ")"; + CHECK(score_index < coord_start || score_index > coord_end) +<< "score_index: " << score_index << " conflict with coordinates: (" +
[GitHub] eric-haibin-lin commented on issue #8611: optimization for dot(csr.T, dense) = rsp
eric-haibin-lin commented on issue #8611: optimization for dot(csr.T, dense) = rsp URL: https://github.com/apache/incubator-mxnet/pull/8611#issuecomment-343603981 Yes, the original dot(csr.T, dense) performance is not good. The same for scipy - it's not always faster than the dense dot even with very sparse data. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] eric-haibin-lin commented on a change in pull request #8611: optimization for dot(csr.T, dense) = rsp
eric-haibin-lin commented on a change in pull request #8611: optimization for dot(csr.T, dense) = rsp URL: https://github.com/apache/incubator-mxnet/pull/8611#discussion_r150351688 ## File path: src/operator/tensor/dot-inl.h ## @@ -598,40 +614,52 @@ inline void DotCsrDnsRspImpl(const OpContext& ctx, const TBlob col_idx_l = lhs.aux_data(csr::kIdx); const TBlob& data_r = rhs; - // pre-allocate spaces for ret using the dense dimension size - ret->CheckAndAlloc({mshadow::Shape1(lhs.shape()[1])}); - const TBlob data_out = ret->data(); - const TBlob row_idx_out = ret->aux_data(rowsparse::kIdx); - MSHADOW_SGL_DBL_TYPE_SWITCH(data_l.type_flag_, DType, { // data type MSHADOW_IDX_TYPE_SWITCH(indptr_l.type_flag_, IType, { // indptr type MSHADOW_IDX_TYPE_SWITCH(col_idx_l.type_flag_, CType, { // col idx type -MSHADOW_IDX_TYPE_SWITCH(row_idx_out.type_flag_, RType, { // row idx type +MSHADOW_IDX_TYPE_SWITCH(ret->aux_type(rowsparse::kIdx), RType, { // row idx type + const dim_t num_rows = lhs.shape()[1]; + size_t workspace_size = 2 * (num_rows * sizeof(dim_t)); + mshadow::Tensorworkspace = +ctx.requested[0].get_space_typed ( +mshadow::Shape1(workspace_size), s); + dim_t* row_flg = reinterpret_cast (workspace.dptr_); + dim_t* prefix_sum = row_flg + num_rows; + + Fill(s, TBlob(row_flg, mshadow::Shape1(num_rows), cpu::kDevMask), kWriteTo, 0); + mxnet_op::Kernel ::Launch(s, lhs.aux_shape(csr::kIdx)[0], row_flg, +col_idx_l.dptr()); + + prefix_sum[0] = row_flg[0]; + for (nnvm::dim_t i = 1; i < num_rows; i++) { +prefix_sum[i] = prefix_sum[i - 1] + row_flg[i]; + } + dim_t nnr = prefix_sum[num_rows - 1]; + + if (nnr == 0) { +FillZerosRspImpl(s, *ret); +return; + } + + ret->CheckAndAlloc({mshadow::Shape1(nnr)}); + const TBlob& data_out = ret->data(); + const TBlob& row_idx = ret->aux_data(rowsparse::kIdx); + dim_t num_threads = data_out.Size(); mxnet_op::Kernel ::Launch(s, num_threads, data_out.dptr()); - RType* row_idx = row_idx_out.dptr(); - num_threads = row_idx_out.Size(); - mxnet_op::Kernel ::Launch(s, num_threads, row_idx); - num_threads = mxnet_op::get_num_threads(data_out.shape_[0]); - dim_t seg_len = (data_out.shape_[0] + num_threads - 1) / num_threads; + RType* row_idx_out = row_idx.dptr(); + + mxnet_op::Kernel ::Launch(s, num_rows, +row_idx_out, prefix_sum, num_rows); + + num_threads = mxnet_op::get_num_threads(ret->shape()[0]); + dim_t seg_len = (ret->shape()[0] + num_threads - 1) / num_threads; Review comment: Should we replace `ret->shape()[0] ` by `nnr` instead? https://github.com/apache/incubator-mxnet/blob/master/src/operator/tensor/indexing_op.h#L661 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] eric-haibin-lin commented on a change in pull request #8611: optimization for dot(csr.T, dense) = rsp
eric-haibin-lin commented on a change in pull request #8611: optimization for dot(csr.T, dense) = rsp URL: https://github.com/apache/incubator-mxnet/pull/8611#discussion_r150351336 ## File path: src/operator/tensor/dot-inl.h ## @@ -573,6 +577,18 @@ inline void DotCsrDnsDnsImpl(const OpContext& ctx, }); } + +struct MarkCsrColKernel { Review comment: Can we reuse this kernel and give it a better name? https://github.com/apache/incubator-mxnet/blob/master/src/operator/tensor/util/tensor_util-inl.h#L37 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] thirdwing commented on issue #8545: Incorrect results from R 3.4.2 in MNIST
thirdwing commented on issue #8545: Incorrect results from R 3.4.2 in MNIST URL: https://github.com/apache/incubator-mxnet/issues/8545#issuecomment-343598024 https://github.com/apache/incubator-mxnet/pull/8121 will also fix this, right? @jeremiedb This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] thirdwing commented on issue #8575: mxnet multicore on LInux in R
thirdwing commented on issue #8575: mxnet multicore on LInux in R URL: https://github.com/apache/incubator-mxnet/issues/8575#issuecomment-343597753 Please provide a reproducible example. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] thirdwing commented on issue #8121: [R] Initializer fix and adjustments to RNN API
thirdwing commented on issue #8121: [R] Initializer fix and adjustments to RNN API URL: https://github.com/apache/incubator-mxnet/pull/8121#issuecomment-343597558 @jeremiedb Sorry for the long delay. Just a minor question. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] thirdwing commented on a change in pull request #8121: [R] Initializer fix and adjustments to RNN API
thirdwing commented on a change in pull request #8121: [R] Initializer fix and adjustments to RNN API URL: https://github.com/apache/incubator-mxnet/pull/8121#discussion_r150346131 ## File path: R-package/R/initializer.R ## @@ -4,11 +4,11 @@ #' @param shape the shape of the array to be generated. #' mx.init.internal.default <- function(name, shape, ctx, allow.unknown=FALSE) { - if (endsWith(name, "bias")) return (mx.nd.zeros(shape, ctx)) - if (endsWith(name, "gamma")) return (mx.nd.ones(shape, ctx)) - if (endsWith(name, "beta")) return (mx.nd.zeros(shape, ctx)) - if (endsWith(name, "moving_mean")) return (mx.nd.zeros(shape, ctx)) - if (endsWith(name, "moving_var")) return (mx.nd.ones(shape, ctx)) + if (endsWith(name, "bias")) return (mx.nd.zeros(shape)) Review comment: Why we need to remove the `ctx`? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] piiswrong opened a new pull request #8612: generalize array dataset
piiswrong opened a new pull request #8612: generalize array dataset URL: https://github.com/apache/incubator-mxnet/pull/8612 ## Description ## (Brief description on what this PR is about) ## Checklist ## ### Essentials ### - [ ] Passed code style checking (`make lint`) - [ ] Changes are complete (i.e. I finished coding on this PR) - [ ] All changes have test coverage - [ ] For user-facing API changes, API doc string has been updated. For new C++ functions in header files, their functionalities and arguments are well-documented. - [ ] To my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change ### Changes ### - [ ] Feature1, tests, (and when applicable, API doc) - [ ] Feature2, tests, (and when applicable, API doc) ## Comments ## - If this change is a backward incompatible change, why must this change be made. - Interesting edge cases to note here This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] cjolivier01 commented on a change in pull request #8302: Refactor operators
cjolivier01 commented on a change in pull request #8302: Refactor operators URL: https://github.com/apache/incubator-mxnet/pull/8302#discussion_r150338088 ## File path: src/operator/nn/batch_norm.cc ## @@ -313,45 +314,76 @@ void BatchNormOp::DoBackward(mshadow::Stream *, } } -template<> -Operator *CreateOp(BatchNormParam param, const int dtype, const TShape& shape) { - param.axis = mxnet::op::batchnorm::GetRealAxis(shape, param.axis); - Operator *op = nullptr; -#if MXNET_USE_MKL2017 == 1 - if (shape.ndim() == 4 - && param.axis == mxnet::op::batchnorm::DEFAULT_AXIS - && !mxnet::op::batchnorm::disable_mkl) { -switch (dtype) { - case mshadow::kFloat32: -op = new MKLBatchNormOp (param); -break; - case mshadow::kFloat64: -op = new MKLBatchNormOp (param); -break; - default: -// MKL operator doesn't support half_t, so fall through -break; -} - } -#endif - if (!op) { -MSHADOW_REAL_TYPE_SWITCH_EX(dtype, -DType, -AccReal, { - op = new BatchNormOp (param); }); +DMLC_REGISTER_PARAMETER(BatchNormParam); + +static bool BatchNormShape(const nnvm::NodeAttrs& attrs, +std::vector *in_shape, std::vector *out_shape) { + const BatchNormParam& param = nnvm::get(attrs.parsed); + using namespace mshadow; + CHECK_EQ(in_shape->size(), 5U) << "Input:[data, gamma, beta, MovingMean, MovingVar]"; + const TShape = in_shape->at(0); + + const size_t channelAxis = static_cast(param.axis < 0 + ? static_cast(dshape.ndim()) + param.axis + : param.axis); + CHECK_LT(channelAxis, dshape.ndim()) << "Channel axis out of range: " << param.axis; + + const int channelCount = dshape[channelAxis]; + + if (dshape.ndim() == 0) { +return false; } - return op; + + in_shape->at(1) = TShape(Shape1(channelCount)); + in_shape->at(2) = TShape(Shape1(channelCount)); + in_shape->at(3) = TShape(Shape1(channelCount)); // kMovingMean + in_shape->at(4) = TShape(Shape1(channelCount)); // kMovingVar + + out_shape->clear(); + out_shape->push_back(dshape);// kOut + out_shape->push_back(Shape1(channelCount)); // kMean + out_shape->push_back(Shape1(channelCount)); // kVar + + return true; } -// DO_BIND_DISPATCH comes from operator_common.h -Operator *BatchNormProp::CreateOperatorEx(Context ctx, std::vector *in_shape, - std::vector *in_type) const { - DO_BIND_DISPATCH(CreateOp, param_, (*in_type)[0], (*in_shape)[0]); +static inline std::vector ListArguments() { Review comment: You may need to replace LegacyOpRunner with CoreOpRunner in batch norm unit tests in cpp gtest tests This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] piiswrong closed pull request #8539: expose group2ctx to module
piiswrong closed pull request #8539: expose group2ctx to module URL: https://github.com/apache/incubator-mxnet/pull/8539 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/python/mxnet/module/bucketing_module.py b/python/mxnet/module/bucketing_module.py index f3c7ecbddc..dd6cafb277 100644 --- a/python/mxnet/module/bucketing_module.py +++ b/python/mxnet/module/bucketing_module.py @@ -52,10 +52,12 @@ class BucketingModule(BaseModule): state_names : list of str States are similar to data and label, but not provided by data iterator. Instead they are initialized to 0 and can be set by set_states() +group2ctxs : list of dict of str to context +Default is `None`. Mapping the `ctx_group` attribute to the context assignment. """ def __init__(self, sym_gen, default_bucket_key=None, logger=logging, context=ctx.cpu(), work_load_list=None, - fixed_param_names=None, state_names=None): + fixed_param_names=None, state_names=None, group2ctxs=None): super(BucketingModule, self).__init__(logger=logger) assert default_bucket_key is not None @@ -77,6 +79,7 @@ def __init__(self, sym_gen, default_bucket_key=None, logger=logging, self._state_names = state_names self._context = context self._work_load_list = work_load_list +self._group2ctxs = group2ctxs self._buckets = {} self._curr_module = None @@ -319,7 +322,7 @@ def bind(self, data_shapes, label_shapes=None, for_training=True, module = Module(symbol, data_names, label_names, logger=self.logger, context=self._context, work_load_list=self._work_load_list, fixed_param_names=self._fixed_param_names, -state_names=self._state_names) +state_names=self._state_names, group2ctxs=self._group2ctxs) module.bind(data_shapes, label_shapes, for_training, inputs_need_grad, force_rebind=False, shared_module=None, grad_req=grad_req) self._curr_module = module @@ -349,7 +352,7 @@ def switch_bucket(self, bucket_key, data_shapes, label_shapes=None): logger=self.logger, context=self._context, work_load_list=self._work_load_list, fixed_param_names=self._fixed_param_names, -state_names=self._state_names) +state_names=self._state_names, group2ctxs=self._group2ctxs) module.bind(data_shapes, label_shapes, self._curr_module.for_training, self._curr_module.inputs_need_grad, force_rebind=False, shared_module=self._buckets[self._default_bucket_key]) diff --git a/python/mxnet/module/executor_group.py b/python/mxnet/module/executor_group.py index 0f3c079f8f..ea7651b65d 100755 --- a/python/mxnet/module/executor_group.py +++ b/python/mxnet/module/executor_group.py @@ -139,10 +139,12 @@ class DataParallelExecutorGroup(object): Requirement for gradient accumulation. Can be 'write', 'add', or 'null' (default to 'write'). Can be specified globally (str) or for each argument (list, dict). +group2ctxs : list of dict of str to context +Default is `None`. Mapping the `ctx_group` attribute to the context assignment. """ def __init__(self, symbol, contexts, workload, data_shapes, label_shapes, param_names, for_training, inputs_need_grad, shared_group=None, logger=logging, - fixed_param_names=None, grad_req='write', state_names=None): + fixed_param_names=None, grad_req='write', state_names=None, group2ctxs=None): self.param_names = param_names self.arg_names = symbol.list_arguments() self.aux_names = symbol.list_auxiliary_states() @@ -150,6 +152,10 @@ def __init__(self, symbol, contexts, workload, data_shapes, label_shapes, param_ self.symbol = symbol self.contexts = contexts self.workload = workload +if group2ctxs is None: +group2ctxs = [None] * len(self.contexts) +assert len(group2ctxs) == len(self.contexts) +self.group2ctxs = group2ctxs self.for_training = for_training self.inputs_need_grad = inputs_need_grad @@ -597,9 +603,11 @@ def _bind_ith_exec(self, i, data_shapes, label_shapes, shared_group): if label_shapes is not None: input_types.update({x.name: x.dtype for x in label_shapes}) +group2ctx = self.group2ctxs[i] + executor = self.symbol.simple_bind(ctx=context, grad_req=self.grad_req,
[incubator-mxnet] branch master updated: expose group2ctx to module (#8539)
This is an automated email from the ASF dual-hosted git repository. jxie 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 c9bde1b expose group2ctx to module (#8539) c9bde1b is described below commit c9bde1b02b89b5c4b987be1d3950d716b3a21692 Author: Ziyue HuangAuthorDate: Sat Nov 11 04:40:51 2017 +0800 expose group2ctx to module (#8539) * expose group2ctx to module * Update test_module.py * address comments * update --- python/mxnet/module/bucketing_module.py | 9 -- python/mxnet/module/executor_group.py | 12 +-- python/mxnet/module/module.py | 8 +++-- tests/python/unittest/test_module.py| 57 + 4 files changed, 79 insertions(+), 7 deletions(-) diff --git a/python/mxnet/module/bucketing_module.py b/python/mxnet/module/bucketing_module.py index f3c7ecb..dd6cafb 100644 --- a/python/mxnet/module/bucketing_module.py +++ b/python/mxnet/module/bucketing_module.py @@ -52,10 +52,12 @@ class BucketingModule(BaseModule): state_names : list of str States are similar to data and label, but not provided by data iterator. Instead they are initialized to 0 and can be set by set_states() +group2ctxs : list of dict of str to context +Default is `None`. Mapping the `ctx_group` attribute to the context assignment. """ def __init__(self, sym_gen, default_bucket_key=None, logger=logging, context=ctx.cpu(), work_load_list=None, - fixed_param_names=None, state_names=None): + fixed_param_names=None, state_names=None, group2ctxs=None): super(BucketingModule, self).__init__(logger=logger) assert default_bucket_key is not None @@ -77,6 +79,7 @@ class BucketingModule(BaseModule): self._state_names = state_names self._context = context self._work_load_list = work_load_list +self._group2ctxs = group2ctxs self._buckets = {} self._curr_module = None @@ -319,7 +322,7 @@ class BucketingModule(BaseModule): module = Module(symbol, data_names, label_names, logger=self.logger, context=self._context, work_load_list=self._work_load_list, fixed_param_names=self._fixed_param_names, -state_names=self._state_names) +state_names=self._state_names, group2ctxs=self._group2ctxs) module.bind(data_shapes, label_shapes, for_training, inputs_need_grad, force_rebind=False, shared_module=None, grad_req=grad_req) self._curr_module = module @@ -349,7 +352,7 @@ class BucketingModule(BaseModule): logger=self.logger, context=self._context, work_load_list=self._work_load_list, fixed_param_names=self._fixed_param_names, -state_names=self._state_names) +state_names=self._state_names, group2ctxs=self._group2ctxs) module.bind(data_shapes, label_shapes, self._curr_module.for_training, self._curr_module.inputs_need_grad, force_rebind=False, shared_module=self._buckets[self._default_bucket_key]) diff --git a/python/mxnet/module/executor_group.py b/python/mxnet/module/executor_group.py index 0f3c079..ea7651b 100755 --- a/python/mxnet/module/executor_group.py +++ b/python/mxnet/module/executor_group.py @@ -139,10 +139,12 @@ class DataParallelExecutorGroup(object): Requirement for gradient accumulation. Can be 'write', 'add', or 'null' (default to 'write'). Can be specified globally (str) or for each argument (list, dict). +group2ctxs : list of dict of str to context +Default is `None`. Mapping the `ctx_group` attribute to the context assignment. """ def __init__(self, symbol, contexts, workload, data_shapes, label_shapes, param_names, for_training, inputs_need_grad, shared_group=None, logger=logging, - fixed_param_names=None, grad_req='write', state_names=None): + fixed_param_names=None, grad_req='write', state_names=None, group2ctxs=None): self.param_names = param_names self.arg_names = symbol.list_arguments() self.aux_names = symbol.list_auxiliary_states() @@ -150,6 +152,10 @@ class DataParallelExecutorGroup(object): self.symbol = symbol self.contexts = contexts self.workload = workload +if group2ctxs is None: +group2ctxs = [None] * len(self.contexts) +assert len(group2ctxs) == len(self.contexts) +self.group2ctxs = group2ctxs self.for_training = for_training self.inputs_need_grad =
[GitHub] piiswrong commented on a change in pull request #8566: optimize broadcast
piiswrong commented on a change in pull request #8566: optimize broadcast URL: https://github.com/apache/incubator-mxnet/pull/8566#discussion_r150332277 ## File path: src/operator/mxnet_op.h ## @@ -345,6 +394,13 @@ __global__ void mxnet_generic_kernel(int N, Args... args) { } } +template +__global__ void mxnet_generic_kernel_ex(int N, Args... args) { + for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; i += blockDim.x * gridDim.x) { +OP::Map(i, 1, args...); Review comment: For GPU the fastest way is to add a step. Each thread work on N elements separated by step This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] zheng-da commented on a change in pull request #8302: Refactor operators
zheng-da commented on a change in pull request #8302: Refactor operators URL: https://github.com/apache/incubator-mxnet/pull/8302#discussion_r150330094 ## File path: src/operator/nn/fully_connected-inl.h ## @@ -176,124 +162,80 @@ class FullyConnectedOp : public Operator { linalg_gemm(grad, wmat, gdata, false, false, s, req[fullc::kData]); } + static FullyConnectedOp _op(const FullyConnectedParam& param) { +static thread_local FullyConnectedOp op; +op.Init(param); +return op; + } + Review comment: I agree that we can make activation completely stateless. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[incubator-mxnet] branch master updated: Update PR & Issue Template (#8555)
This is an automated email from the ASF dual-hosted git repository. jxie 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 97e7015 Update PR & Issue Template (#8555) 97e7015 is described below commit 97e70150cd282fe02c27d86eb37e4543cec4a1a1 Author: Haibin LinAuthorDate: Fri Nov 10 10:32:01 2017 -0800 Update PR & Issue Template (#8555) * Update PULL_REQUEST_TEMPLATE.md * Update ISSUE_TEMPLATE.md * Update PULL_REQUEST_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md| 4 ++-- .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index c7536d3..5279dd2 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,6 +1,6 @@ -Note: Providing complete information in the most concise form is the best way to get help. This issue template serves as the checklist for essential information to most of the technical issues. +Note: Providing complete information in the most concise form is the best way to get help. This issue template serves as the checklist for essential information to most of the technical issues and bug reports. For non-technical issues and feature requests, feel free to present the information in what you believe is the best form. -If the issue is non-technical, feel free to present the information in what you believe is the best form. +For Q & A and discussion, please start a discussion thread at https://discuss.mxnet.io ## Description (Brief description of the problem in no more than 2 sentences.) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 9a2d274..468be29 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,7 +6,7 @@ - [ ] Passed code style checking (`make lint`) - [ ] Changes are complete (i.e. I finished coding on this PR) - [ ] All changes have test coverage -- [ ] For user-facing API changes, API doc string has been updated. +- [ ] For user-facing API changes, API doc string has been updated. For new C++ functions in header files, their functionalities and arguments are well-documented. - [ ] To my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change ### Changes ### @@ -15,4 +15,4 @@ ## Comments ## - If this change is a backward incompatible change, why must this change be made. -- Intersting edge cases to note here +- Interesting edge cases to note here -- To stop receiving notification emails like this one, please contact ['"comm...@mxnet.apache.org" '].
[GitHub] piiswrong closed pull request #8555: Update PR & Issue Template
piiswrong closed pull request #8555: Update PR & Issue Template URL: https://github.com/apache/incubator-mxnet/pull/8555 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index c7536d37fd..5279dd24a7 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,6 +1,6 @@ -Note: Providing complete information in the most concise form is the best way to get help. This issue template serves as the checklist for essential information to most of the technical issues. +Note: Providing complete information in the most concise form is the best way to get help. This issue template serves as the checklist for essential information to most of the technical issues and bug reports. For non-technical issues and feature requests, feel free to present the information in what you believe is the best form. -If the issue is non-technical, feel free to present the information in what you believe is the best form. +For Q & A and discussion, please start a discussion thread at https://discuss.mxnet.io ## Description (Brief description of the problem in no more than 2 sentences.) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 9a2d274de9..468be298b8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,7 +6,7 @@ - [ ] Passed code style checking (`make lint`) - [ ] Changes are complete (i.e. I finished coding on this PR) - [ ] All changes have test coverage -- [ ] For user-facing API changes, API doc string has been updated. +- [ ] For user-facing API changes, API doc string has been updated. For new C++ functions in header files, their functionalities and arguments are well-documented. - [ ] To my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change ### Changes ### @@ -15,4 +15,4 @@ ## Comments ## - If this change is a backward incompatible change, why must this change be made. -- Intersting edge cases to note here +- Interesting edge cases to note here This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] reminisce commented on issue #8246: Continued Work on Advanced Indexing
reminisce commented on issue #8246: Continued Work on Advanced Indexing URL: https://github.com/apache/incubator-mxnet/pull/8246#issuecomment-343549343 @piiswrong @eric-haibin-lin @szha I added support for `__setitem__` and simplified basic and advanced indexing dispatching logic. Please review again. Thanks. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] zhreshold commented on issue #8603: Contrib operators for object-detection bounding box related stuffs
zhreshold commented on issue #8603: Contrib operators for object-detection bounding box related stuffs URL: https://github.com/apache/incubator-mxnet/pull/8603#issuecomment-343542184 @sbodenstein Functionally, yes, but not identical api. This one provide more options. Do you have a suggestion for the name? There's an alias "box_non_maximum_suppression" This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] fungtion opened a new issue #4159: How to bind 3 inputs using mxnet.io.NDArrayIter?
fungtion opened a new issue #4159: How to bind 3 inputs using mxnet.io.NDArrayIter? URL: https://github.com/apache/incubator-mxnet/issues/4159 For bugs or installation issues, please provide the following information. The more information you provide, the more likely people will be able to help you. ## Environment info Operating System: Ubuntu 14.04 Compiler:python 2.7 Package used (Python/R/Scala/Julia):python I want to feed the convolution net with triple input: image, annotation, label. According to #2929, I define the input using mxnet.io.NDArrayIter as: ``` import mxnet as mx import numpy as np train = mx.io.NDArrayIter(data=np.zeros((12, 3, 224, 224), dtype='float32'), label={'label1': np.zeros((12, 81), dtype='int8'), 'label2': np.zeros((12, ), dtype='int8')}, batch_size=10) ``` However, I got an error: **include/mxnet/./tensor_blob.h:742:check failed: (this->shape_.Size())==(shape.size()) TBlob.get_with_shape: new and old shape do not match total elements** and **TypeError: Invalid type' for data, should be NDArray or numpy.ndarray'** Does it means data and label should match in shape? And how can I feed triple input (one data and two kinds of label) to network? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] ptrendx commented on issue #8600: How many new data points does data augmentation with mx.io.ImageRecordIter produce?
ptrendx commented on issue #8600: How many new data points does data augmentation with mx.io.ImageRecordIter produce? URL: https://github.com/apache/incubator-mxnet/issues/8600#issuecomment-343538346 Augmentations do not increase the size of your dataset explicitly. How it works is that every time an iterator sees a particular image (so once every epoch) it augments it producing 1 output (so every epoch you will see slightly different image). This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] ZiyueHuang opened a new pull request #8611: optimization for dot(csr.T, dense) = rsp
ZiyueHuang opened a new pull request #8611: optimization for dot(csr.T, dense) = rsp URL: https://github.com/apache/incubator-mxnet/pull/8611 ## Description ## Use prefix sum to compute `nnr` in order to allocate the row_sparse output. Currently `dot(csr.T, dense) = rsp` will allocate the dense output and then cast it to row_sparse, but not free the unused memory. I use `run_benchmark(context, lhs="csr", rhs="default", lhs_trans=True, ...)` in `mxnet/benchmark/python/sparse/dot.py`. Please correct me if I'm wrong. But is `dot(csr.T, dense) = rsp` in master slow like this? Might due to others are using my machine at the same time? Performance of origin `dot(csr.T, dense) = rsp`, ``` [hanfeng@model-gpu00:sparse]$ python dot.py --num-omp-threads 20 mxnet sparse dot benchmark: dot(csr, default) = default (matrix multiplication: (m x k)^T * (k x n) = m x n) lhs_density(%) rhs_density(%)contextmkn t_sparse(ms) t_dense(ms) speedup 1.0 100.0 cpu(0) 128 100 256 366.19135.76 0.37 1.0 100.0 cpu(0) 128 100 1000 1327.12503.92 0.38 1.0 100.0 cpu(0) 128 100 1000 1237.33454.01 0.37 1.0 100.0 cpu(0) 64 100 1000 868.38345.38 0.40 1.0 100.0 cpu(0) 128 100 1000 1237.09437.32 0.35 ``` After this PR, ``` [hanfeng@model-gpu00:sparse]$ python dot.py --num-omp-threads 20 mxnet sparse dot benchmark: dot(csr, default) = default (matrix multiplication: (m x k)^T * (k x n) = m x n) lhs_density(%) rhs_density(%)contextmkn t_sparse(ms) t_dense(ms) speedup 1.0 100.0 cpu(0) 128 100 256 83.90137.18 1.64 1.0 100.0 cpu(0) 128 100 1000 410.63448.30 1.09 1.0 100.0 cpu(0) 128 100 1000 467.91492.87 1.05 1.0 100.0 cpu(0) 64 100 1000 259.99348.32 1.34 1.0 100.0 cpu(0) 128 100 1000 481.77416.20 0.86 ``` cc @eric-haibin-lin ## Checklist ## ### Essentials ### - [x] Passed code style checking (`make lint`) - [x] Changes are complete (i.e. I finished coding on this PR) - [x] All changes have test coverage - [x] For user-facing API changes, API doc string has been updated. - [x] To my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change ### Changes ### - [x] unittests already exist ## Comments ## - If this change is a backward incompatible change, why must this change be made. - Intersting edge cases to note here This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] aidan-plenert-macdonald commented on issue #8591: How do I make a siamese network with pretrained models (esp. keeping the weights the same?)
aidan-plenert-macdonald commented on issue #8591: How do I make a siamese network with pretrained models (esp. keeping the weights the same?) URL: https://github.com/apache/incubator-mxnet/issues/8591#issuecomment-343536911 If you want to share weights across the network, why not just use one copy of the network and run it twice with the inputs? ```python final_net(nd.concat(shared_net(x), shared_net(x))) ``` Also, I definitely recommend using Gluon instead of pure MxNet This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] kaylimekay commented on issue #7698: Second order gradient and Subgraph execution
kaylimekay commented on issue #7698: Second order gradient and Subgraph execution URL: https://github.com/apache/incubator-mxnet/pull/7698#issuecomment-343535842 Is there a list of operators that currently support the higher order gradients from grad()? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] cjolivier01 commented on issue #8572: use first class cuda with cmake 3.9 and cuda9.0 support
cjolivier01 commented on issue #8572: use first class cuda with cmake 3.9 and cuda9.0 support URL: https://github.com/apache/incubator-mxnet/pull/8572#issuecomment-343533256 Is this ready to merge? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] jeremiedb commented on issue #8121: [R] Initializer fix and adjustments to RNN API
jeremiedb commented on issue #8121: [R] Initializer fix and adjustments to RNN API URL: https://github.com/apache/incubator-mxnet/pull/8121#issuecomment-343527120 @thirdwing Anytime remaining to fix? I thin this PR is important as no training process is currently broken by the initializer issue. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] anjishnu commented on issue #4159: How to bind 3 inputs using mxnet.io.NDArrayIter?
anjishnu commented on issue #4159: How to bind 3 inputs using mxnet.io.NDArrayIter? URL: https://github.com/apache/incubator-mxnet/issues/4159#issuecomment-343505909 I am also using a network architecture like OP which takes in 2 streams as input. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] anjishnu commented on issue #4159: How to bind 3 inputs using mxnet.io.NDArrayIter?
anjishnu commented on issue #4159: How to bind 3 inputs using mxnet.io.NDArrayIter? URL: https://github.com/apache/incubator-mxnet/issues/4159#issuecomment-343505315 I just got this issue - > TypeError: Invalid type '' for x_2, should be NDArray, numpy.ndarray or h5py.Dataset I only seem get it when my array is > certain number of elements. I reduce my array size and the code seems to run fine. Is the suggested solution to write my own DataIter? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] mstokes42 commented on issue #8601: Why is the accuracy overestimated?
mstokes42 commented on issue #8601: Why is the accuracy overestimated? URL: https://github.com/apache/incubator-mxnet/issues/8601#issuecomment-343499688 I figured out the problem was with my batch_size on the val_iter. The sample size was not a multiple of the batch size, so some samples were being discarded by the model.score call that uses val_iter. By changing the batch size to equal the number of samples, the accuracy comes out correct. Now I'm having an issue where by model performs well on the training data, but performs worse than random on the test data. I'd be better off taking the output of the classifier and predicting the opposite. When I apply the model to a different held-out validation set, though, the model again performs almost perfectly... what could explain this behavior? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] lilhope opened a new issue #8610: How to resize the image to same shape in ImageRecordIter?
lilhope opened a new issue #8610: How to resize the image to same shape in ImageRecordIter? URL: https://github.com/apache/incubator-mxnet/issues/8610 Hi, I have a set of images with various shapes and I write it to `.rec` file,and using `mx.io.ImageRecordIter` to load it. But I met an error: ``` Check failed: static_cast(res.rows) >= param_.data_shape[1] && static_cast(res.cols) >= param_.data_shape[2] input image size smaller than input shape ``` I tried different ways to solve it but not works. such as set`resize mode`,`inter_method`, any helps will be appreciated. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] mwunderlich opened a new issue #8609: git clone command wrong for Scala setup
mwunderlich opened a new issue #8609: git clone command wrong for Scala setup URL: https://github.com/apache/incubator-mxnet/issues/8609 The git clone command provided for the scala setup on OSX (on page https://mxnet.incubator.apache.org/install/osx_setup.html) seems to be wrong. When I use `git clone --recursive https://github.com/apache/incubator-mxnet.git mxnet --branch 0.12.0 ~/mxnet` I get this error: `Too many arguments.` Using this it works fine: `git clone --recursive --branch 0.12.0 https://github.com/apache/incubator-mxnet.git ~/mxnet` This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] sbodenstein commented on issue #8582: Yolo2 operator
sbodenstein commented on issue #8582: Yolo2 operator URL: https://github.com/apache/incubator-mxnet/pull/8582#issuecomment-343462534 One more comment on this PR: is there anyway of verifying that the gradient is correctly calculated? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] szha closed issue #7420: simple_bind failed error
szha closed issue #7420: simple_bind failed error URL: https://github.com/apache/incubator-mxnet/issues/7420 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] szha closed issue #7422: Data provided by data_shapes don't match names specified by data_names
szha closed issue #7422: Data provided by data_shapes don't match names specified by data_names URL: https://github.com/apache/incubator-mxnet/issues/7422 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] szha closed issue #7414: why rnn train speed is not stable,sometims very slow?
szha closed issue #7414: why rnn train speed is not stable,sometims very slow? URL: https://github.com/apache/incubator-mxnet/issues/7414 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] szha commented on issue #7420: simple_bind failed error
szha commented on issue #7420: simple_bind failed error URL: https://github.com/apache/incubator-mxnet/issues/7420#issuecomment-343460770 This issue is closed due to lack of activity in the last 90 days. Feel free to ping me to reopen if this is still an active issue. Thanks! Also, do please check out our [forum](https://discuss.mxnet.io/) (and [Chinese version](https://discuss.gluon.ai/)) for general "how-to" questions. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] szha commented on issue #7414: why rnn train speed is not stable,sometims very slow?
szha commented on issue #7414: why rnn train speed is not stable,sometims very slow? URL: https://github.com/apache/incubator-mxnet/issues/7414#issuecomment-343460773 This issue is closed due to lack of activity in the last 90 days. Feel free to ping me to reopen if this is still an active issue. Thanks! Also, do please check out our [forum](https://discuss.mxnet.io/) (and [Chinese version](https://discuss.gluon.ai/)) for general "how-to" questions. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] szha commented on issue #7422: Data provided by data_shapes don't match names specified by data_names
szha commented on issue #7422: Data provided by data_shapes don't match names specified by data_names URL: https://github.com/apache/incubator-mxnet/issues/7422#issuecomment-343460775 This issue is closed due to lack of activity in the last 90 days. Feel free to ping me to reopen if this is still an active issue. Thanks! Also, do please check out our [forum](https://discuss.mxnet.io/) (and [Chinese version](https://discuss.gluon.ai/)) for general "how-to" questions. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wkcn commented on issue #8569: The conflict between MXNet and OpenCV
wkcn commented on issue #8569: The conflict between MXNet and OpenCV URL: https://github.com/apache/incubator-mxnet/issues/8569#issuecomment-343458075 @KellenSunderland Thank you! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] KellenSunderland commented on issue #8569: The conflict between MXNet and OpenCV
KellenSunderland commented on issue #8569: The conflict between MXNet and OpenCV URL: https://github.com/apache/incubator-mxnet/issues/8569#issuecomment-343442891 @wkcn Thanks, for the info. I think your description on the relation between the USE_GPERFTOOLS flag and the crash is clear. I just saw some other similar reports that were dependent on the order you initialize opencv in relation to the gperf using library (i.e. mxnet in this case). This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] tz-hmc commented on issue #8591: How do I make a siamese network with pretrained models (esp. keeping the weights the same?)
tz-hmc commented on issue #8591: How do I make a siamese network with pretrained models (esp. keeping the weights the same?) URL: https://github.com/apache/incubator-mxnet/issues/8591#issuecomment-343438692 Wow. Thank you so much. Alright, this gives me a lot to think about. I'm really grateful for your help, thanks a ton. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] asmushetzel commented on a change in pull request #8577: support for lapack functions with mkl
asmushetzel commented on a change in pull request #8577: support for lapack functions with mkl URL: https://github.com/apache/incubator-mxnet/pull/8577#discussion_r150193519 ## File path: src/operator/c_lapack_api.h ## @@ -160,7 +162,75 @@ inline void flip(int m, int n, } -#if MXNET_USE_LAPACK +#if (MSHADOW_USE_MKL && MXNET_USE_LAPACK) + + // We interface with the C-interface of MKL + // as this is the preferred way. + #include + + #define MXNET_LAPACK_ROW_MAJOR LAPACK_ROW_MAJOR + #define MXNET_LAPACK_COL_MAJOR LAPACK_COL_MAJOR + + // These function have already matching signature. + #define MXNET_LAPACK_spotrf LAPACKE_spotrf + #define MXNET_LAPACK_dpotrf LAPACKE_dpotrf + #define MXNET_LAPACK_spotri LAPACKE_spotri + #define MXNET_LAPACK_dpotri LAPACKE_dpotri + #define mxnet_lapack_sposv LAPACKE_sposv + #define mxnet_lapack_dposv LAPACKE_dposv + + // The following functions differ in signature from the + // MXNET_LAPACK-signature and have to be wrapped. + #define MXNET_LAPACK_CWRAP_GELQF(prefix, dtype) \ + inline int MXNET_LAPACK_##prefix##gelqf(int matrix_layout, int m, int n, \ + dtype *a, int lda, dtype* tau, \ + dtype* work, int lwork) { \ +if (lwork != -1) { \ + return LAPACKE_##prefix##gelqf(matrix_layout, m, n, a, lda, tau); \ +} \ +*work = 0; \ +return 0; \ + } + MXNET_LAPACK_CWRAP_GELQF(s, float) + MXNET_LAPACK_CWRAP_GELQF(d, double) + + #define MXNET_LAPACK_CWRAP_ORGLQ(prefix, dtype) \ + inline int MXNET_LAPACK_##prefix##orglq(int matrix_layout, int m, int n, \ + dtype *a, int lda, dtype* tau, \ + dtype* work, int lwork) { \ +if (lwork != -1) { \ + return LAPACKE_##prefix##orglq(matrix_layout, m, n, m, a, lda, tau); \ +} \ +*work = 0; \ +return 0; \ + } + MXNET_LAPACK_CWRAP_ORGLQ(s, float) + MXNET_LAPACK_CWRAP_ORGLQ(d, double) + + // This has to be called internally in COL_MAJOR format even when matrix_layout + // is row-major as otherwise the eigenvectors would be returned as cols in a + // row-major matrix layout (see MKL documentation). + // We also have to allocate at least one DType element as workspace as the + // calling code assumes that the workspace has at least that size. + #define MXNET_LAPACK_CWRAP_SYEVD(prefix, dtype) \ + inline int MXNET_LAPACK_##prefix##syevd(int matrix_layout, char uplo, int n, dtype *a, \ Review comment: Yes it is a function name. We could argue that we ant to use lower case, on the other hand using capital MXNET_LAPACK as a prefix for anything lapack related was already introduced longer time ago, so this just adheres to this convention. Are you suggesting to change all the function definitions/calls to lowercase prefixes? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] KellenSunderland commented on issue #8573: /usr/bin/ld: cannot find -lgtest ?
KellenSunderland commented on issue #8573: /usr/bin/ld: cannot find -lgtest ? URL: https://github.com/apache/incubator-mxnet/issues/8573#issuecomment-343424577 Hello @eLvErDe , looks like you're missing the gtest library on your system. The good news is it's quite easy to install. Here's a SO answer that outlines the process https://stackoverflow.com/questions/13513905/how-to-setup-googletest-as-a-shared-library-on-linux This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wkcn commented on issue #8569: The conflict between MXNet and OpenCV
wkcn commented on issue #8569: The conflict between MXNet and OpenCV URL: https://github.com/apache/incubator-mxnet/issues/8569#issuecomment-343424178 @KellenSunderland The crash will occur too if importing cv2 after mxnet with `gperftools`. I set `USE_GPERFTOOLS = 0` and `USE_JEMALLOC = 0`. Rebuild mxnet without `gperftools`. There will be no crash. `USE_GPERFTOOLS = 1` is the default setting. When the machine doesn't have `gperftools`, the building will not have `gperftools`. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] KellenSunderland commented on issue #8569: The conflict between MXNet and OpenCV
KellenSunderland commented on issue #8569: The conflict between MXNet and OpenCV URL: https://github.com/apache/incubator-mxnet/issues/8569#issuecomment-343421365 Out of curiosity, does the crash occur if you import cv2 after mxnet? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] sbodenstein commented on a change in pull request #8603: Contrib operators for object-detection bounding box related stuffs
sbodenstein commented on a change in pull request #8603: Contrib operators for object-detection bounding box related stuffs URL: https://github.com/apache/incubator-mxnet/pull/8603#discussion_r150181423 ## File path: src/operator/contrib/bounding_box.cc ## @@ -0,0 +1,194 @@ +/* + * 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 + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + /*! + * Copyright (c) 2017 by Contributors + * \file bounding_box.cc + * \brief Bounding box util functions and operators + * \author Joshua Zhang + */ + +#include "./bounding_box-inl.h" +#include "../elemwise_op_common.h" + +namespace mxnet { +namespace op { +DMLC_REGISTER_PARAMETER(BoxNMSParam); +DMLC_REGISTER_PARAMETER(BoxOverlapParam); +DMLC_REGISTER_PARAMETER(BipartiteMatchingParam); + +NNVM_REGISTER_OP(_contrib_box_nms) +.add_alias("_contrib_box_non_maximum_suppression") +.describe(R"code(Apply non-maximum suppression to input. + +The output will be sorted in descending order according to `score`. Boxes with +overlaps larger than `overlap_thresh` and smaller scores will be removed and +filled with -1, the corresponding position will be recorded for backward propogation. + +During back-propagation, the gradient will be copied to the original +position according to the input index. For positions that have been suppressed, +the in_grad will be assigned 0. +In summary, gradients are sticked to its boxes, will either be moved or discarded +according to its original index in input. + +Input requirements: +1. Input tensor have at least 2 dimensions, (n, k), any higher dims will be regarded +as batch, e.g. (a, b, c, d, n, k) == (a*b*c*d, n, k) +2. n is the number of boxes in each batch +3. k is the width of each box item. + +By default, a box is [id, score, xmin, ymin, xmax, ymax, ...], +additional elements are allowed. +- `id_index`: optional, use -1 to ignore, useful if `force_suppress=False`, which means +we will skip highly overlapped boxes if one is `apple` while the other is `car`. +- `coord_start`: required, default=2, the starting index of the 4 coordinates. +Two formats are supported: + `corner`: [xmin, ymin, xmax, ymax] + `center`: [x, y, width, height] +- `score_index`: required, default=1, box score/confidence. +When two boxes overlap IOU > `overlap_thresh`, the one with smaller score will be suppressed. +- `in_format` and `out_format`: default='corner', specify in/out box formats. + +Examples:: + + x = [[0, 0.5, 0.1, 0.1, 0.2, 0.2], [1, 0.4, 0.1, 0.1, 0.2, 0.2], + [0, 0.3, 0.1, 0.1, 0.14, 0.14], [2, 0.6, 0.5, 0.5, 0.7, 0.8]] + box_nms(x, overlap_thresh=0.1, coord_start=2, score_index=1, id_index=0, + force_suppress=True, in_format='corner', out_typ='corner') = + [[2, 0.6, 0.5, 0.5, 0.7, 0.8], [0, 0.5, 0.1, 0.1, 0.2, 0.2], + [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1]] + out_grad = [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1], [0.2, 0.2, 0.2, 0.2, 0.2, 0.2], + [0.3, 0.3, 0.3, 0.3, 0.3, 0.3], [0.4, 0.4, 0.4, 0.4, 0.4, 0.4]] + # exe.backward + in_grad = [[0.2, 0.2, 0.2, 0.2, 0.2, 0.2], [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], [0.1, 0.1, 0.1, 0.1, 0.1, 0.1]] + +)code" ADD_FILELINE) +.set_num_inputs(1) +.set_num_outputs(2) +.set_attr_parser(ParamParser) +.set_attr("FNumVisibleOutputs", BoxNMSNumVisibleOutputs) +.set_attr("FInferShape", BoxNMSShape) +.set_attr("FInferType", ElemwiseType<1, 2>) +.set_attr("FResourceRequest", + [](const NodeAttrs& attrs) { +return std::vector{ResourceRequest::kTempSpace}; + }) +.set_attr("FCompute", BoxNMSForward) +.set_attr("FGradient", ElemwiseGradUseOut{"_backward_contrib_box_nms"}) +.add_argument("data", "NDArray-or-Symbol", "The input") +.add_arguments(BoxNMSParam::__FIELDS__()); + +NNVM_REGISTER_OP(_backward_contrib_box_nms) +.set_num_inputs(3) +.set_num_outputs(1) +.set_attr_parser(ParamParser) +.set_attr("TIsBackward", true) +.set_attr("FCompute", BoxNMSBackward) +.add_arguments(BoxNMSParam::__FIELDS__()); + +NNVM_REGISTER_OP(_contrib_box_iou) +.describe(R"doc(Bounding box overlap of two arrays. + The overlap is defined as Intersection-over-Union, aka, IOU. + - lhs: (a_1, a_2, ..., a_n, 4) array + - rhs: (b_1, b_2, ..., b_n, 4) array + - output: (a_1, a_2, ..., a_n, b_1, b_2, ...,
[GitHub] sbodenstein commented on issue #8603: Contrib operators for object-detection bounding box related stuffs
sbodenstein commented on issue #8603: Contrib operators for object-detection bounding box related stuffs URL: https://github.com/apache/incubator-mxnet/pull/8603#issuecomment-343414068 Is the NMS op consistent with TensorFlows [`tf.image.non_max_suppression`](https://github.com/tensorflow/models/blob/master/research/object_detection/utils/np_box_list_ops.py)? And is that perhaps a better name than `box_nms`? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] mseeger commented on issue #8338: master branch cannot build on centos 7 with cuda-8.0
mseeger commented on issue #8338: master branch cannot build on centos 7 with cuda-8.0 URL: https://github.com/apache/incubator-mxnet/issues/8338#issuecomment-343414021 @asmushetzel Hi Asmus, some people continue to have problems building on some CentOS setup that I cannot work on. Maybe we can go over my changes briefly, and you flag things that may be non-CUDA? However, I worked on this with @piiswrong The files in questions are src/operator/ - mshadow_op.h - math_functions-inl.h (new) This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] mseeger commented on issue #8338: master branch cannot build on centos 7 with cuda-8.0
mseeger commented on issue #8338: master branch cannot build on centos 7 with cuda-8.0 URL: https://github.com/apache/incubator-mxnet/issues/8338#issuecomment-343413652 Hello, I'd like to help, but I just cannot reproduce the error (given it is still the same as the one described above). Here some points: - I'd need the full error output. If some template is expanded, would have to know for which ops in mshadow_op.h. An obvious thing to try is to revert things back to before my changes for these ops only - Why was the original issue closed? Something must have solved the problem, and now maybe this is just a different problem? At least, we need error outputs for the new problem, and maybe this should be a different issue? - What is your hunch what is happening here? What cc or cu code is actually built here? My hunches of what to try: - The new math_functions-inl.h introduces a lot of functions exp, log, ... in the namespace mxnet::op::math. Maybe this clashes with something else you are doing? One thing to try would be to rename the namespace math => math_debug. This also needs mshadow_op.h changes, but nowhere else (I think) - Figure out exactly which ops in mshadow_op.h are implicated, and then change their code back to older versions - To explain what my changes did: The mshadow_op.h ops now consistently cast inputs to float for all DType != double, but leave them double for DType = double. The computation is then done in float or double, and if DType != double, we cast back to DType at the end. The input is cast with static_cast(a), the result is cast back with DType(result). - The code before my changes did things differently: The forward ops were always computed in float, also if DType = double. Also, they would do ::expf(a) instead of ::expf(static_cast(a)), which should be the same. More serious, the gradient (backward) ops were often doing computations in DType if only arithmetic was involved (*, +, even /), but in float if math.h functions were involved. This is plain wrong. In my changes, also all gradient ops cast to float, whether math.h functions are involved or not @zhreshold How would this fail in CI in windows, etc., if it does not fail for all other PRs that passed CI since my changes? This makes no sense, right? If CI fails for you, please provide some full error outputs. BTW: CI fails randomly for many reasons all the time, unfortunately. Make sure it fails with the errors you are reporting here (and please, re-report them). This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] liumilan closed issue #8574: how to print debug log in gpu mode?
liumilan closed issue #8574: how to print debug log in gpu mode? URL: https://github.com/apache/incubator-mxnet/issues/8574 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services