├── .gitignore ├── .gitmodules ├── .travis.yml ├── CMakeLists.txt ├── CONTRIBUTORS.md ├── LICENSE ├── MKL_README.md ├── Makefile ├── NEWS.md ├── R-package ├── .Rbuildignore ├── .gitignore ├── DESCRIPTION ├── LICENSE ├── NAMESPACE ├── R │ ├── callback.R │ ├── context.R │ ├── executor.R │ ├── gru.R │ ├── initializer.R │ ├── io.R │ ├── kvstore.R │ ├── lr_scheduler.R │ ├── lstm.R │ ├── metric.R │ ├── mlp.R │ ├── model.R │ ├── mxnet_generated.R │ ├── ndarray.R │ ├── optimizer.R │ ├── random.R │ ├── rnn.R │ ├── rnn_model.R │ ├── symbol.R │ ├── util.R │ ├── viz.graph.R │ └── zzz.R ├── README.md ├── demo │ ├── 00Index │ ├── basic_bench.R │ ├── basic_executor.R │ ├── basic_kvstore.R │ ├── basic_model.R │ ├── basic_ndarray.R │ ├── basic_random.R │ └── basic_symbol.R ├── man │ ├── Ops.MXNDArray.Rd │ ├── arguments.Rd │ ├── as.array.MXNDArray.Rd │ ├── as.matrix.MXNDArray.Rd │ ├── ctx.Rd │ ├── dim.MXNDArray.Rd │ ├── graph.viz.Rd │ ├── is.mx.context.Rd │ ├── is.mx.dataiter.Rd │ ├── is.mx.ndarray.Rd │ ├── is.mx.symbol.Rd │ ├── length.MXNDArray.Rd │ ├── mx.apply.Rd │ ├── mx.callback.log.train.metric.Rd │ ├── mx.callback.save.checkpoint.Rd │ ├── mx.cpu.Rd │ ├── mx.ctx.default.Rd │ ├── mx.exec.backward.Rd │ ├── mx.exec.forward.Rd │ ├── mx.exec.update.arg.arrays.Rd │ ├── mx.exec.update.aux.arrays.Rd │ ├── mx.exec.update.grad.arrays.Rd │ ├── mx.gpu.Rd │ ├── mx.gru.Rd │ ├── mx.gru.forward.Rd │ ├── mx.gru.inference.Rd │ ├── mx.init.Xavier.Rd │ ├── mx.init.create.Rd │ ├── mx.init.internal.default.Rd │ ├── mx.init.normal.Rd │ ├── mx.init.uniform.Rd │ ├── mx.io.CSVIter.Rd │ ├── mx.io.ImageRecordIter.Rd │ ├── mx.io.MNISTIter.Rd │ ├── mx.io.arrayiter.Rd │ ├── mx.io.extract.Rd │ ├── mx.kv.create.Rd │ ├── mx.lstm.Rd │ ├── mx.lstm.forward.Rd │ ├── mx.lstm.inference.Rd │ ├── mx.metric.accuracy.Rd │ ├── mx.metric.custom.Rd │ ├── mx.metric.mae.Rd │ ├── mx.metric.rmse.Rd │ ├── mx.metric.rmsle.Rd │ ├── mx.mlp.Rd │ ├── mx.model.FeedForward.create.Rd │ ├── mx.model.load.Rd │ ├── mx.model.save.Rd │ ├── mx.nd.abs.Rd │ ├── mx.nd.argmax.channel.Rd │ ├── mx.nd.array.Rd │ ├── mx.nd.ceil.Rd │ ├── mx.nd.choose.element.0index.Rd │ ├── mx.nd.clip.Rd │ ├── mx.nd.copyto.Rd │ ├── mx.nd.cos.Rd │ ├── mx.nd.dot.Rd │ ├── mx.nd.exp.Rd │ ├── mx.nd.fill.element.0index.Rd │ ├── mx.nd.floor.Rd │ ├── mx.nd.load.Rd │ ├── mx.nd.log.Rd │ ├── mx.nd.max.Rd │ ├── mx.nd.min.Rd │ ├── mx.nd.norm.Rd │ ├── mx.nd.ones.Rd │ ├── mx.nd.round.Rd │ ├── mx.nd.rsqrt.Rd │ ├── mx.nd.save.Rd │ ├── mx.nd.sign.Rd │ ├── mx.nd.sin.Rd │ ├── mx.nd.sqrt.Rd │ ├── mx.nd.square.Rd │ ├── mx.nd.sum.Rd │ ├── mx.nd.zeros.Rd │ ├── mx.opt.adadelta.Rd │ ├── mx.opt.adagrad.Rd │ ├── mx.opt.adam.Rd │ ├── mx.opt.create.Rd │ ├── mx.opt.get.updater.Rd │ ├── mx.opt.rmsprop.Rd │ ├── mx.opt.sgd.Rd │ ├── mx.rnn.Rd │ ├── mx.rnn.forward.Rd │ ├── mx.rnn.inference.Rd │ ├── mx.rnorm.Rd │ ├── mx.runif.Rd │ ├── mx.set.seed.Rd │ ├── mx.simple.bind.Rd │ ├── mx.symbol.Activation.Rd │ ├── mx.symbol.BatchNorm.Rd │ ├── mx.symbol.BlockGrad.Rd │ ├── mx.symbol.Cast.Rd │ ├── mx.symbol.Concat.Rd │ ├── mx.symbol.Convolution.Rd │ ├── mx.symbol.Crop.Rd │ ├── mx.symbol.Deconvolution.Rd │ ├── mx.symbol.Dropout.Rd │ ├── mx.symbol.ElementWiseSum.Rd │ ├── mx.symbol.Embedding.Rd │ ├── mx.symbol.Flatten.Rd │ ├── mx.symbol.FullyConnected.Rd │ ├── mx.symbol.Group.Rd │ ├── mx.symbol.IdentityAttachKLSparseReg.Rd │ ├── mx.symbol.LRN.Rd │ ├── mx.symbol.LeakyReLU.Rd │ ├── mx.symbol.LinearRegressionOutput.Rd │ ├── mx.symbol.LogisticRegressionOutput.Rd │ ├── mx.symbol.MAERegressionOutput.Rd │ ├── mx.symbol.Pooling.Rd │ ├── mx.symbol.Reshape.Rd │ ├── mx.symbol.SliceChannel.Rd │ ├── mx.symbol.Softmax.Rd │ ├── mx.symbol.SoftmaxActivation.Rd │ ├── mx.symbol.SoftmaxOutput.Rd │ ├── mx.symbol.SwapAxis.Rd │ ├── mx.symbol.UpSampling.Rd │ ├── mx.symbol.Variable.Rd │ ├── mx.symbol.abs.Rd │ ├── mx.symbol.ceil.Rd │ ├── mx.symbol.cos.Rd │ ├── mx.symbol.exp.Rd │ ├── mx.symbol.floor.Rd │ ├── mx.symbol.infer.shape.Rd │ ├── mx.symbol.load.Rd │ ├── mx.symbol.load.json.Rd │ ├── mx.symbol.log.Rd │ ├── mx.symbol.round.Rd │ ├── mx.symbol.rsqrt.Rd │ ├── mx.symbol.save.Rd │ ├── mx.symbol.sign.Rd │ ├── mx.symbol.sin.Rd │ ├── mx.symbol.sqrt.Rd │ ├── mx.symbol.square.Rd │ ├── mxnet.Rd │ ├── mxnet.export.Rd │ ├── outputs.Rd │ ├── predict.MXFeedForwardModel.Rd │ └── print.MXNDArray.Rd ├── src │ ├── Makevars │ ├── Makevars.win │ ├── base.h │ ├── executor.cc │ ├── executor.h │ ├── export.cc │ ├── export.h │ ├── io.cc │ ├── io.h │ ├── kvstore.cc │ ├── kvstore.h │ ├── mxnet.cc │ ├── name.h │ ├── ndarray.cc │ ├── ndarray.h │ ├── symbol.cc │ └── symbol.h ├── tests │ ├── testthat.R │ └── testthat │ │ ├── test_lstm.R │ │ ├── test_model.R │ │ ├── test_ndarray.R │ │ └── test_symbol.R └── vignettes │ ├── CallbackFunctionTutorial.Rmd │ ├── CharRnnModel.Rmd │ ├── classifyRealImageWithPretrainedModel.Rmd │ ├── fiveMinutesNeuralNetwork.Rmd │ ├── mnistCompetition.Rmd │ └── ndarrayAndSymbolTutorial.Rmd ├── README.md ├── amalgamation ├── .gitignore ├── Makefile ├── README.md ├── amalgamation.py ├── jni │ ├── org │ │ └── dmlc │ │ │ └── mxnet │ │ │ ├── MxnetException.java │ │ │ └── Predictor.java │ ├── org_dmlc_mxnet_Predictor.h │ └── predictor.cc ├── mxnet_predict0.cc └── python │ └── mxnet_predict.py ├── appveyor.yml ├── cmake ├── Modules │ ├── FindAtlas.cmake │ ├── FindMKL.cmake │ └── FindOpenBLAS.cmake └── Utils.cmake ├── docker ├── README.md ├── cpu │ └── Dockerfile └── cuda │ └── Dockerfile ├── docs ├── .dockerignore ├── .gitignore ├── Dockerfile ├── Doxyfile ├── Makefile ├── README.md ├── _static │ ├── cn.svg │ ├── js │ │ ├── auto_module_index.js │ │ ├── search.js │ │ └── sidebar.js │ ├── mxnet-theme │ │ ├── footer.html │ │ ├── index.html │ │ ├── layout.html │ │ ├── navbar.html │ │ └── theme.conf │ ├── mxnet.css │ ├── selectlang.js │ └── us.svg ├── api │ ├── c++ │ │ └── index.md │ ├── julia │ │ └── index.md │ ├── python │ │ ├── index.md │ │ ├── io.md │ │ ├── kvstore.md │ │ ├── model.md │ │ ├── module.md │ │ ├── ndarray.md │ │ ├── symbol.md │ │ └── symbol_in_pictures.md │ ├── r │ │ ├── Makefile │ │ └── index.md │ └── scala │ │ └── index.md ├── architecture │ ├── index.md │ ├── note_data_loading.md │ ├── note_engine.md │ ├── note_memory.md │ ├── overview.md │ ├── program_model.md │ ├── read_code.md │ └── rnn_interface.md ├── build-notebooks.sh ├── build-preview.sh ├── community │ ├── contribute.md │ └── index.md ├── conf.py ├── get_started │ ├── index.md │ ├── overview_zh.md │ └── setup.md ├── how_to │ ├── bucketing.md │ ├── caffe.md │ ├── cloud.md │ ├── develop_and_hack.md │ ├── env_var.md │ ├── faq.md │ ├── index.md │ ├── model_parallel_lstm.md │ ├── multi_devices.md │ ├── new_op.md │ ├── perf.md │ ├── smart_device.md │ └── torch.md ├── index.md ├── packages │ ├── c++ │ │ └── index.rst │ ├── julia │ │ └── index.rst │ ├── python │ │ ├── index.rst │ │ ├── io.rst │ │ ├── kvstore.rst │ │ ├── model.rst │ │ ├── module.rst │ │ ├── ndarray.rst │ │ ├── symbol.rst │ │ ├── symbol_in_pictures.rst │ │ └── tutorial.rst │ ├── r │ │ ├── CallbackFunctionTutorial.rst │ │ ├── CharRnnModel.rst │ │ ├── classifyRealImageWithPretrainedModel.rst │ │ ├── fiveMinutesNeuralNetwork.rst │ │ ├── index.rst │ │ ├── mnistCompetition.rst │ │ └── ndarrayAndSymbolTutorial.rst │ └── scala │ │ └── index.rst ├── requirements.txt ├── sphinx_util.py ├── system │ ├── engine.rst │ ├── index.rst │ ├── multi_node.rst │ ├── note_data_loading.rst │ ├── note_engine.rst │ ├── note_memory.rst │ ├── operator.rst │ ├── operator_util.rst │ ├── program_model.rst │ └── rnn_interface.rst ├── tutorials │ ├── computer_vision │ │ ├── detection.md │ │ ├── image_classification.md │ │ ├── imagenet_full.md │ │ ├── neural_art.md │ │ └── segmentation.md │ ├── general_ml │ │ └── recommendation_systems.md │ ├── index.md │ ├── nlp │ │ ├── cnn.md │ │ ├── nce_loss.md │ │ └── rnn.md │ ├── python │ │ ├── kvstore.md │ │ ├── ndarray.md │ │ └── symbol.md │ ├── r │ │ ├── CallbackFunctionTutorial.md │ │ ├── charRnnModel.md │ │ ├── classifyRealImageWithPretrainedModel.md │ │ ├── fiveMinutesNeuralNetwork.md │ │ ├── mnistCompetition.md │ │ ├── ndarray.md │ │ └── symbol.md │ ├── scala │ │ └── mnist.md │ ├── speech_recognition │ │ ├── baidu_warp_ctc.md │ │ └── speech_lstm.md │ └── unsupervised_learning │ │ ├── auto_encoders.md │ │ └── gan.md └── zh │ ├── api │ ├── python │ │ ├── index.md │ │ ├── io.md │ │ ├── kvstore.md │ │ └── ndarray.md │ └── r │ │ ├── CallbackFunctionTutorial.md │ │ ├── CharRnnModel.Rmd │ │ └── fiveMinutesNeuralNetwork.md │ ├── architecture │ ├── dep_engine.md │ ├── index.md │ ├── multi_node.md │ ├── note_data_loading.md │ └── operator.md │ ├── index.md │ ├── mxnet-dep-engine-implemention.md │ ├── note_memory.md │ └── overview.md ├── example ├── README.md ├── adversary │ ├── README.md │ ├── adversary_generation.ipynb │ └── data.py ├── autoencoder │ ├── autoencoder.py │ ├── data.py │ ├── mnist_sae.py │ ├── model.py │ └── solver.py ├── bayesian-methods │ ├── README.md │ ├── algos.py │ ├── bdk.ipynb │ ├── bdk_demo.py │ ├── data_loader.py │ ├── sgld.ipynb │ └── utils.py ├── bi-lstm-sort │ ├── README.md │ ├── infer_sort.py │ ├── lstm.py │ ├── lstm_sort.py │ ├── rnn_model.py │ └── sort_io.py ├── caffe │ ├── README.md │ ├── caffe_net.py │ ├── data.py │ └── train_model.py ├── cnn_text_classification │ ├── README.md │ ├── data_helpers.py │ └── text_cnn.py ├── dec │ └── dec.py ├── fcn-xs │ ├── README.md │ ├── data.py │ ├── fcn_xs.py │ ├── image_segmentaion.py │ ├── init_fcnxs.py │ ├── run_fcnxs.sh │ ├── solver.py │ └── symbol_fcnxs.py ├── gan │ └── dcgan.py ├── image-classification │ ├── README.md │ ├── __init__.py │ ├── benchmark.py │ ├── common │ │ ├── __init__.py │ │ ├── data.py │ │ ├── find_mxnet.py │ │ ├── fit.py │ │ ├── modelzoo.py │ │ └── util.py │ ├── data │ │ └── caltech256.sh │ ├── fine-tune.py │ ├── predict-cpp │ │ ├── Makefile │ │ ├── README.md │ │ └── image-classification-predict.cc │ ├── score.py │ ├── symbol │ │ ├── README.md │ │ ├── __init__.py │ │ ├── alexnet.py │ │ ├── googlenet.py │ │ ├── inception-bn.py │ │ ├── inception-v3.py │ │ ├── lenet.py │ │ ├── mlp.py │ │ ├── resnet.py │ │ └── vgg.py │ ├── symbol_alexnet.R │ ├── symbol_googlenet.R │ ├── symbol_inception-bn-28-small.R │ ├── symbol_inception-bn.R │ ├── symbol_inception-resnet-v1.R │ ├── symbol_inception-resnet-v2.R │ ├── symbol_lenet.R │ ├── symbol_mlp.R │ ├── symbol_resnet-28-small.R │ ├── symbol_resnet-v2.R │ ├── symbol_resnet.R │ ├── symbol_unet.R │ ├── symbol_vgg.R │ ├── test_score.py │ ├── train_cifar10.R │ ├── train_cifar10.py │ ├── train_imagenet.R │ ├── train_imagenet.py │ ├── train_mnist.R │ ├── train_mnist.py │ └── train_model.R ├── kaggle-ndsb1 │ ├── README.md │ ├── gen_img_list.py │ ├── predict_dsb.py │ ├── submission_dsb.py │ ├── symbol_dsb.py │ ├── train_dsb.py │ └── training_curves.py ├── kaggle-ndsb2 │ ├── Preprocessing.py │ ├── README.md │ ├── Train.R │ └── Train.py ├── memcost │ ├── Makefile │ ├── README.md │ └── inception_memcost.py ├── model-parallel-lstm │ ├── README.md │ ├── get_ptb_data.sh │ ├── lstm.py │ └── lstm_ptb.py ├── module │ ├── lstm_bucketing.py │ ├── mnist_mlp.py │ ├── python_loss.py │ ├── sequential_module.py │ ├── train_cifar10.ipynb │ └── train_cifar10.py ├── multi-task │ ├── README.md │ ├── data.py │ └── example_multi_task.py ├── nce-loss │ ├── README.md │ ├── get_text8.sh │ ├── lstm_word.py │ ├── nce.py │ ├── toy_nce.py │ ├── toy_softmax.py │ ├── wordvec.py │ └── wordvec_subwords.py ├── neural-style │ ├── .gitignore │ ├── README.md │ ├── checkpoint-viewer.ipynb │ ├── download.sh │ ├── end_to_end │ │ ├── README.md │ │ ├── basic.py │ │ ├── boost_inference.py │ │ ├── boost_train.py │ │ ├── data_processing.py │ │ ├── gen_v3.py │ │ ├── gen_v4.py │ │ └── model_vgg19.py │ ├── find_mxnet.py │ ├── model_vgg19.py │ ├── neuralart.ipynb │ └── nstyle.py ├── notebooks │ ├── cifar-100.ipynb │ ├── cifar10-recipe.ipynb │ ├── class_active_maps.ipynb │ ├── cnn-text-classification.ipynb │ ├── composite_symbol.ipynb │ ├── predict-with-pretrained-model.ipynb │ ├── simple_bind.ipynb │ └── tutorial.ipynb ├── numpy-ops │ ├── README.md │ ├── custom_softmax.py │ ├── data.py │ ├── ndarray_softmax.py │ └── numpy_softmax.py ├── python-howto │ ├── README.md │ ├── data.py │ ├── data_iter.py │ ├── monitor_weights.py │ └── multiple_outputs.py ├── rcnn │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── __init__.py │ ├── demo.py │ ├── helper │ │ ├── __init__.py │ │ ├── dataset │ │ │ ├── __init__.py │ │ │ ├── imdb.py │ │ │ ├── pascal_voc.py │ │ │ └── voc_eval.py │ │ └── processing │ │ │ ├── __init__.py │ │ │ ├── bbox_process.py │ │ │ ├── bbox_regression.py │ │ │ ├── bbox_transform.py │ │ │ ├── generate_anchor.py │ │ │ ├── image_processing.py │ │ │ ├── nms.py │ │ │ └── roidb.py │ ├── rcnn │ │ ├── __init__.py │ │ ├── callback.py │ │ ├── config.py │ │ ├── data_iter.py │ │ ├── detector.py │ │ ├── loader.py │ │ ├── metric.py │ │ ├── minibatch.py │ │ ├── module.py │ │ ├── rpn │ │ │ ├── __init__.py │ │ │ ├── generate.py │ │ │ ├── proposal.py │ │ │ └── proposal_target.py │ │ ├── symbol.py │ │ └── tester.py │ ├── test.py │ ├── test │ │ ├── __init__.py │ │ ├── test_data_iter.py │ │ └── test_imdb.py │ ├── tools │ │ ├── __init__.py │ │ ├── test_rcnn.py │ │ ├── test_rpn.py │ │ ├── train_rcnn.py │ │ └── train_rpn.py │ ├── train_alternate.py │ ├── train_end2end.py │ └── utils │ │ ├── __init__.py │ │ ├── caffe_convert.py │ │ ├── combine_model.py │ │ ├── load_data.py │ │ ├── load_model.py │ │ └── save_model.py ├── recommenders │ ├── .gitignore │ ├── README.md │ ├── crossentropy.py │ ├── demo1-MF.ipynb │ ├── demo1-MF2-fancy.ipynb │ ├── demo2-binary.ipynb │ ├── demo3-dssm.ipynb │ ├── matrix_fact.py │ ├── movielens_data.py │ ├── negativesample.py │ ├── randomproj.py │ ├── recotools.py │ └── symbol_alexnet.py ├── reinforcement-learning │ ├── ddpg │ │ ├── README.md │ │ ├── ddpg.py │ │ ├── policies.py │ │ ├── qfuncs.py │ │ ├── replay_mem.py │ │ ├── run.py │ │ ├── strategies.py │ │ └── utils.py │ └── dqn │ │ ├── README.md │ │ ├── atari_game.py │ │ ├── base.py │ │ ├── dqn_demo.py │ │ ├── dqn_run_test.py │ │ ├── game.py │ │ ├── operators.py │ │ ├── replay_memory.py │ │ └── utils.py ├── rnn-time-major │ ├── bucket_io.py │ └── rnn_cell_demo.py ├── rnn │ ├── README.md │ ├── bucket_io.py │ ├── char-rnn.ipynb │ ├── get_ptb_data.sh │ ├── gru.py │ ├── gru_bucketing.py │ ├── lstm.py │ ├── lstm_bucketing.py │ ├── lstm_ptb.R │ ├── rnn.py │ ├── rnn_cell_demo.py │ └── rnn_model.py ├── speech-demo │ ├── README.md │ ├── config_util.py │ ├── decode_mxnet.py │ ├── decode_mxnet.sh │ ├── default.cfg │ ├── io_func │ │ ├── __init__.py │ │ ├── convert2kaldi.py │ │ ├── feat_io.py │ │ ├── feat_readers │ │ │ ├── __init__.py │ │ │ ├── common.py │ │ │ ├── reader_atrack.py │ │ │ ├── reader_bvec.py │ │ │ ├── reader_htk.py │ │ │ ├── reader_kaldi.py │ │ │ ├── stats.py │ │ │ └── writer_kaldi.py │ │ ├── info.py │ │ ├── kaldi_parser.py │ │ ├── model_io.py │ │ ├── regr_feat_io.py │ │ └── utils.py │ ├── io_util.py │ ├── lstm_proj.py │ ├── make_stats.py │ ├── python_wrap │ │ ├── Makefile │ │ ├── ctypes.cc │ │ └── example_usage │ │ │ ├── README.txt │ │ │ ├── data.ark │ │ │ ├── data.scp │ │ │ ├── data.txt │ │ │ └── example.py │ ├── run_ami.sh │ ├── speechSGD.py │ ├── tests │ │ ├── test_nothing.py │ │ └── test_system.py │ └── train_lstm_proj.py ├── ssd │ ├── README.md │ ├── __init__.py │ ├── config │ │ ├── __init__.py │ │ └── config.py │ ├── data │ │ └── demo │ │ │ └── download_demo_images.py │ ├── dataset │ │ ├── __init__.py │ │ ├── concat_db.py │ │ ├── imdb.py │ │ ├── iterator.py │ │ ├── pascal_voc.py │ │ ├── testdb.py │ │ └── yolo_format.py │ ├── demo.py │ ├── deploy.py │ ├── detect │ │ ├── __init__.py │ │ └── detector.py │ ├── evaluate.py │ ├── evaluate │ │ ├── __init__.py │ │ ├── eval_voc.py │ │ └── evaluate_net.py │ ├── model │ │ └── README.md │ ├── operator │ │ ├── multibox_detection-inl.h │ │ ├── multibox_detection.cc │ │ ├── multibox_detection.cu │ │ ├── multibox_prior-inl.h │ │ ├── multibox_prior.cc │ │ ├── multibox_prior.cu │ │ ├── multibox_target-inl.h │ │ ├── multibox_target.cc │ │ └── multibox_target.cu │ ├── symbol │ │ ├── __init__.py │ │ ├── common.py │ │ └── symbol_vgg16_reduced.py │ ├── tools │ │ ├── __init__.py │ │ ├── find_mxnet.py │ │ ├── image_processing.py │ │ ├── rand_sampler.py │ │ └── visualize_net.py │ ├── train.py │ └── train │ │ ├── __init__.py │ │ ├── initializer.py │ │ ├── metric.py │ │ └── train_net.py ├── stochastic-depth │ ├── sd_cifar10.py │ ├── sd_mnist.py │ └── sd_module.py ├── svm_mnist │ ├── README.md │ └── svm_mnist.py ├── torch │ ├── data.py │ ├── torch_function.py │ └── torch_module.py └── warpctc │ ├── README.md │ ├── lstm.py │ ├── lstm_ocr.py │ └── toy_ctc.py ├── include └── mxnet │ ├── base.h │ ├── c_api.h │ ├── c_predict_api.h │ ├── engine.h │ ├── io.h │ ├── kvstore.h │ ├── mkl_memory.h │ ├── mxrtc.h │ ├── ndarray.h │ ├── operator.h │ ├── operator_util.h │ ├── optimizer.h │ ├── resource.h │ ├── storage.h │ ├── symbolic.h │ └── tensor_blob.h ├── make ├── config.mk ├── osx.mk └── readthedocs.mk ├── matlab ├── +mxnet │ ├── model.m │ └── private │ │ ├── callmxnet.m │ │ └── parse_json.m ├── README.md ├── demo.m └── tests │ ├── prepare_data.m │ └── test_prediction.m ├── plugin ├── caffe │ ├── README.md │ ├── caffe.mk │ ├── caffe_blob.cc │ ├── caffe_blob.h │ ├── caffe_common.cc │ ├── caffe_common.h │ ├── caffe_data_iter.cc │ ├── caffe_fieldentry.h │ ├── caffe_loss-inl.h │ ├── caffe_loss.cc │ ├── caffe_loss.cu │ ├── caffe_op-inl.h │ ├── caffe_op.cc │ ├── caffe_op.cu │ ├── caffe_stream.cc │ └── caffe_stream.h ├── opencv │ ├── __init__.py │ ├── cv_api.cc │ ├── cv_api.h │ ├── opencv.mk │ └── opencv.py ├── sframe │ ├── iter_sframe.cc │ └── plugin.mk ├── torch │ ├── torch.mk │ ├── torch_base.cc │ ├── torch_base.h │ ├── torch_criterion-inl.h │ ├── torch_criterion.cc │ ├── torch_criterion.cu │ ├── torch_function.cc │ ├── torch_function.h │ ├── torch_module-inl.h │ ├── torch_module.cc │ └── torch_module.cu └── warpctc │ ├── warpctc-inl.h │ ├── warpctc.cc │ ├── warpctc.cu │ └── warpctc.mk ├── prepare_mkl.sh ├── python ├── .gitignore ├── README.md ├── mxnet │ ├── __init__.py │ ├── _ndarray_internal.py │ ├── _symbol_internal.py │ ├── attribute.py │ ├── base.py │ ├── callback.py │ ├── context.py │ ├── executor.py │ ├── executor_manager.py │ ├── initializer.py │ ├── io.py │ ├── kvstore.py │ ├── kvstore_server.py │ ├── libinfo.py │ ├── lr_scheduler.py │ ├── metric.py │ ├── misc.py │ ├── model.py │ ├── module │ │ ├── __init__.py │ │ ├── base_module.py │ │ ├── bucketing_module.py │ │ ├── executor_group.py │ │ ├── module.py │ │ ├── python_module.py │ │ └── sequential_module.py │ ├── monitor.py │ ├── name.py │ ├── ndarray.py │ ├── notebook │ │ ├── __init__.py │ │ └── callback.py │ ├── operator.py │ ├── optimizer.py │ ├── random.py │ ├── recordio.py │ ├── rtc.py │ ├── symbol.py │ ├── symbol_doc.py │ ├── test_utils.py │ ├── torch.py │ └── visualization.py └── setup.py ├── readthedocs.yml ├── scala-package ├── LICENSE ├── README.md ├── assembly │ ├── linux-x86_64-cpu │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── assembly │ │ │ └── assembly.xml │ ├── linux-x86_64-gpu │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── assembly │ │ │ └── assembly.xml │ ├── osx-x86_64-cpu │ │ ├── main │ │ │ └── assembly │ │ │ │ └── assembly.xml │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── assembly │ │ │ └── assembly.xml │ └── pom.xml ├── core │ ├── pom.xml │ ├── scripts │ │ ├── get_cifar_data.sh │ │ └── get_mnist_data.sh │ └── src │ │ ├── main │ │ └── scala │ │ │ └── ml │ │ │ └── dmlc │ │ │ └── mxnet │ │ │ ├── AttrScope.scala │ │ │ ├── Base.scala │ │ │ ├── Callback.scala │ │ │ ├── Context.scala │ │ │ ├── EvalMetric.scala │ │ │ ├── Executor.scala │ │ │ ├── ExecutorManager.scala │ │ │ ├── FeedForward.scala │ │ │ ├── IO.scala │ │ │ ├── Initializer.scala │ │ │ ├── KVStore.scala │ │ │ ├── KVStoreServer.scala │ │ │ ├── LRScheduler.scala │ │ │ ├── LibInfo.scala │ │ │ ├── Model.scala │ │ │ ├── Monitor.scala │ │ │ ├── NDArray.scala │ │ │ ├── NameManager.scala │ │ │ ├── Optimizer.scala │ │ │ ├── Random.scala │ │ │ ├── RecordIO.scala │ │ │ ├── Rtc.scala │ │ │ ├── Serializer.scala │ │ │ ├── Shape.scala │ │ │ ├── Symbol.scala │ │ │ ├── Visualization.scala │ │ │ ├── io │ │ │ ├── MXDataIter.scala │ │ │ ├── NDArrayIter.scala │ │ │ ├── PrefetchingIter.scala │ │ │ └── ResizeIter.scala │ │ │ ├── optimizer │ │ │ ├── AdaDelta.scala │ │ │ ├── AdaGrad.scala │ │ │ ├── Adam.scala │ │ │ ├── NAG.scala │ │ │ ├── RMSProp.scala │ │ │ ├── SGD.scala │ │ │ ├── SGLD.scala │ │ │ └── ccSGD.scala │ │ │ └── util │ │ │ └── NativeLibraryLoader.scala │ │ └── test │ │ ├── resources │ │ └── log4j.properties │ │ └── scala │ │ └── ml │ │ └── dmlc │ │ └── mxnet │ │ ├── AttrScopeSuite.scala │ │ ├── CheckUtils.scala │ │ ├── ExecutorSuite.scala │ │ ├── IOSuite.scala │ │ ├── KVStoreSuite.scala │ │ ├── ModelParallelSuite.scala │ │ ├── NDArraySuite.scala │ │ ├── OperatorSuite.scala │ │ ├── RandomSuite.scala │ │ ├── RecordIOSuite.scala │ │ ├── SerializerSuite.scala │ │ ├── ShapeSuite.scala │ │ ├── SymbolSuite.scala │ │ ├── gpu │ │ └── RtcSuite.scala │ │ └── train │ │ └── ConvSuite.scala ├── dev │ ├── change-proj-version.sh │ └── change-scala-version.sh ├── examples │ ├── pom.xml │ ├── scripts │ │ ├── neuralstyle_end2end │ │ │ ├── run_test_end2end.sh │ │ │ └── run_train_end2end.sh │ │ ├── rnn │ │ │ ├── run_test_charrnn.sh │ │ │ └── run_train_charrnn.sh │ │ ├── run_cnntextclassification.sh │ │ ├── run_gan_mnist.sh │ │ ├── run_multitask.sh │ │ ├── run_neuralstyle.sh │ │ └── run_visualization.sh │ └── src │ │ └── main │ │ ├── resources │ │ └── log4j.properties │ │ └── scala │ │ └── ml │ │ └── dmlc │ │ └── mxnet │ │ └── examples │ │ ├── cnntextclassification │ │ ├── CNNTextClassification.scala │ │ └── DataHelper.scala │ │ ├── gan │ │ ├── GanMnist.scala │ │ ├── Module.scala │ │ └── Viz.scala │ │ ├── imclassification │ │ ├── ModelTrain.scala │ │ └── TrainMnist.scala │ │ ├── multitask │ │ ├── Data.scala │ │ └── ExampleMultiTask.scala │ │ ├── neuralstyle │ │ ├── ModelVgg19.scala │ │ ├── NeuralStyle.scala │ │ └── end2end │ │ │ ├── Basic.scala │ │ │ ├── BoostInference.scala │ │ │ ├── BoostTrain.scala │ │ │ ├── DataProcessing.scala │ │ │ ├── GenV3.scala │ │ │ ├── GenV4.scala │ │ │ ├── ModelVgg19.scala │ │ │ └── Module.scala │ │ ├── rnn │ │ ├── BucketIo.scala │ │ ├── Lstm.scala │ │ ├── LstmBucketing.scala │ │ ├── RnnModel.scala │ │ ├── TestCharRnn.scala │ │ ├── TrainCharRnn.scala │ │ └── Utils.scala │ │ └── visualization │ │ ├── AlexNet.scala │ │ ├── ExampleVis.scala │ │ ├── GoogleNet.scala │ │ ├── Inception_BN.scala │ │ ├── Inception_V3.scala │ │ ├── LeNet.scala │ │ ├── ResNet_Small.scala │ │ └── VGG.scala ├── init-native │ ├── linux-x86_64 │ │ └── pom.xml │ ├── osx-x86_64 │ │ └── pom.xml │ ├── pom.xml │ └── src │ │ └── main │ │ └── native │ │ └── ml_dmlc_mxnet_init_native_c_api.cc ├── init │ ├── pom.xml │ └── src │ │ └── main │ │ └── scala │ │ └── ml │ │ └── dmlc │ │ └── mxnet │ │ └── init │ │ ├── Base.scala │ │ └── LibInfo.scala ├── macros │ ├── pom.xml │ └── src │ │ └── main │ │ └── scala │ │ └── ml │ │ └── dmlc │ │ └── mxnet │ │ └── SymbolMacro.scala ├── native │ ├── linux-x86_64-cpu │ │ └── pom.xml │ ├── linux-x86_64-gpu │ │ └── pom.xml │ ├── osx-x86_64-cpu │ │ └── pom.xml │ ├── pom.xml │ └── src │ │ └── main │ │ └── native │ │ ├── jni_helper_func.h │ │ └── ml_dmlc_mxnet_native_c_api.cc ├── pom.xml ├── scalastyle-config.xml └── spark │ ├── README.md │ ├── bin │ └── run-mnist-example.sh │ ├── pom.xml │ └── src │ └── main │ └── scala │ └── ml │ └── dmlc │ └── mxnet │ └── spark │ ├── MXNDArray.scala │ ├── MXNet.scala │ ├── MXNetModel.scala │ ├── MXNetParams.scala │ ├── ParameterServer.scala │ ├── example │ └── ClassificationExample.scala │ ├── io │ ├── LabeledPointIter.scala │ ├── LongLivingDataBatch.scala │ └── PointIter.scala │ └── utils │ ├── Img2Vector.scala │ ├── Network.scala │ └── RepIterator.scala ├── setup-utils ├── install-mxnet-amz-linux.sh ├── install-mxnet-ubuntu-python.sh └── install-mxnet-ubuntu-r.sh ├── src ├── c_api │ ├── c_api.cc │ ├── c_api_error.cc │ ├── c_api_error.h │ └── c_predict_api.cc ├── common │ ├── cuda_utils.h │ ├── lazy_alloc_array.h │ ├── mxrtc.cc │ ├── object_pool.h │ ├── thread_local.h │ └── utils.h ├── engine │ ├── engine.cc │ ├── engine_impl.h │ ├── naive_engine.cc │ ├── stream_manager.h │ ├── thread_pool.h │ ├── threaded_engine.cc │ ├── threaded_engine.h │ ├── threaded_engine_perdevice.cc │ └── threaded_engine_pooled.cc ├── initialize.cc ├── io │ ├── image_aug_default.cc │ ├── image_augmenter.h │ ├── image_recordio.h │ ├── inst_vector.h │ ├── io.cc │ ├── iter_batchloader.h │ ├── iter_csv.cc │ ├── iter_image_recordio.cc │ ├── iter_mnist.cc │ ├── iter_normalize.h │ └── iter_prefetcher.h ├── kvstore │ ├── comm.h │ ├── kvstore.cc │ ├── kvstore_dist.h │ ├── kvstore_dist_server.h │ └── kvstore_local.h ├── ndarray │ ├── ndarray.cc │ ├── ndarray_function-inl.h │ ├── ndarray_function.cc │ ├── ndarray_function.cu │ └── ndarray_function.h ├── operator │ ├── activation-inl.h │ ├── activation.cc │ ├── activation.cu │ ├── batch_norm-inl.h │ ├── batch_norm.cc │ ├── batch_norm.cu │ ├── block_grad-inl.h │ ├── block_grad.cc │ ├── block_grad.cu │ ├── broadcast_mask_op-inl.h │ ├── broadcast_mask_op.cc │ ├── broadcast_mask_op.cu │ ├── broadcast_reduce_op-inl.h │ ├── broadcast_reduce_op.cc │ ├── broadcast_reduce_op.cu │ ├── broadcast_reduce_op_common.h │ ├── cast-inl.h │ ├── cast.cc │ ├── cast.cu │ ├── channel_op_common.h │ ├── concat-inl.h │ ├── concat.cc │ ├── concat.cu │ ├── convolution-inl.h │ ├── convolution.cc │ ├── convolution.cu │ ├── correlation-inl.h │ ├── correlation.cc │ ├── correlation.cu │ ├── crop-inl.h │ ├── crop.cc │ ├── crop.cu │ ├── cross_device_copy.cc │ ├── cudnn_activation-inl.h │ ├── cudnn_batch_norm-inl.h │ ├── cudnn_batch_norm.cc │ ├── cudnn_batch_norm.cu │ ├── cudnn_convolution-inl.h │ ├── cudnn_convolution.cc │ ├── cudnn_deconvolution-inl.h │ ├── cudnn_lrn-inl.h │ ├── cudnn_pooling-inl.h │ ├── cudnn_rnn-inl.h │ ├── cudnn_softmax_activation-inl.h │ ├── cudnn_spatial_transformer-inl.h │ ├── custom-inl.h │ ├── custom.cc │ ├── deconvolution-inl.h │ ├── deconvolution.cc │ ├── deconvolution.cu │ ├── dropout-inl.h │ ├── dropout.cc │ ├── dropout.cu │ ├── elementwise_binary_broadcast_op-inl.h │ ├── elementwise_binary_broadcast_op.cc │ ├── elementwise_binary_broadcast_op.cu │ ├── elementwise_binary_op-inl.h │ ├── elementwise_binary_op.cc │ ├── elementwise_binary_op.cu │ ├── elementwise_binary_scalar_op-inl.h │ ├── elementwise_binary_scalar_op.cc │ ├── elementwise_binary_scalar_op.cu │ ├── elementwise_sum-inl.h │ ├── elementwise_sum.cc │ ├── elementwise_sum.cu │ ├── elementwise_unary_op-inl.h │ ├── elementwise_unary_op.cc │ ├── elementwise_unary_op.cu │ ├── embedding-inl.h │ ├── embedding.cc │ ├── embedding.cu │ ├── fully_connected-inl.h │ ├── fully_connected.cc │ ├── fully_connected.cu │ ├── identity_attach_KL_sparse_reg-inl.h │ ├── identity_attach_KL_sparse_reg.cc │ ├── identity_attach_KL_sparse_reg.cu │ ├── instance_norm-inl.h │ ├── instance_norm.cc │ ├── instance_norm.cu │ ├── l2_normalization-inl.h │ ├── l2_normalization.cc │ ├── l2_normalization.cu │ ├── leaky_relu-inl.h │ ├── leaky_relu.cc │ ├── leaky_relu.cu │ ├── loss_binary_op-inl.h │ ├── loss_binary_op.cc │ ├── loss_binary_op.cu │ ├── lrn-inl.h │ ├── lrn.cc │ ├── lrn.cu │ ├── make_loss-inl.h │ ├── make_loss.cc │ ├── make_loss.cu │ ├── matrix_op-inl.h │ ├── matrix_op.cc │ ├── matrix_op.cu │ ├── mkl │ │ ├── mkl_batch_norm-inl.h │ │ ├── mkl_concat-inl.h │ │ ├── mkl_convolution-inl.h │ │ ├── mkl_cppwrapper.cc │ │ ├── mkl_cppwrapper.h │ │ ├── mkl_elementwise-inl.h │ │ ├── mkl_fully_connected-inl.h │ │ ├── mkl_lrn-inl.h │ │ ├── mkl_memory-inl.h │ │ ├── mkl_memory.cc │ │ ├── mkl_pooling-inl.h │ │ ├── mkl_relu-inl.h │ │ └── mkl_util-inl.h │ ├── mshadow_op.h │ ├── native_op-inl.h │ ├── native_op.cc │ ├── native_op.cu │ ├── ndarray_op-inl.h │ ├── ndarray_op.cc │ ├── nnpack │ │ └── nnpack_convolution-inl.h │ ├── operator.cc │ ├── operator_common.h │ ├── operator_util.cc │ ├── pad-inl.h │ ├── pad.cc │ ├── pad.cu │ ├── pooling-inl.h │ ├── pooling.cc │ ├── pooling.cu │ ├── regression_output-inl.h │ ├── regression_output.cc │ ├── regression_output.cu │ ├── reshape-inl.h │ ├── reshape.cc │ ├── reshape.cu │ ├── rnn-inl.h │ ├── rnn.cc │ ├── rnn.cu │ ├── roi_pooling-inl.h │ ├── roi_pooling.cc │ ├── roi_pooling.cu │ ├── sample_op-inl.h │ ├── sample_op.cc │ ├── sample_op.cu │ ├── sequence_last-inl.h │ ├── sequence_last.cc │ ├── sequence_last.cu │ ├── sequence_mask-inl.h │ ├── sequence_mask.cc │ ├── sequence_mask.cu │ ├── sequence_op_common.h │ ├── sequence_reverse-inl.h │ ├── sequence_reverse.cc │ ├── sequence_reverse.cu │ ├── slice_channel-inl.h │ ├── slice_channel.cc │ ├── slice_channel.cu │ ├── smooth_l1_unary-inl.h │ ├── smooth_l1_unary.cc │ ├── smooth_l1_unary.cu │ ├── softmax_activation-inl.h │ ├── softmax_activation.cc │ ├── softmax_activation.cu │ ├── softmax_output-inl.h │ ├── softmax_output.cc │ ├── softmax_output.cu │ ├── spatial_transformer-inl.h │ ├── spatial_transformer.cc │ ├── spatial_transformer.cu │ ├── svm_output-inl.h │ ├── svm_output.cc │ ├── svm_output.cu │ ├── swapaxis-inl.h │ ├── swapaxis.cc │ ├── swapaxis.cu │ ├── upsampling-inl.h │ ├── upsampling.cc │ └── upsampling.cu ├── optimizer │ ├── optimizer.cc │ ├── sgd-inl.h │ ├── sgd.cc │ └── sgd.cu ├── resource.cc ├── storage │ ├── cpu_device_storage.h │ ├── gpu_device_storage.h │ ├── naive_storage_manager.h │ ├── pinned_memory_storage.h │ ├── pooled_storage_manager.h │ ├── storage.cc │ └── storage_manager.h └── symbol │ ├── graph_algorithm.h │ ├── graph_executor.cc │ ├── graph_executor.h │ ├── graph_memory_allocator.cc │ ├── graph_memory_allocator.h │ ├── static_graph.cc │ ├── static_graph.h │ └── symbol.cc ├── tests ├── .gitignore ├── cpp │ ├── .gitignore │ ├── storage_test.cc │ ├── threaded_engine_test.cc │ └── unittest.mk ├── jenkins │ ├── format │ └── run_test.sh ├── nightly │ ├── .gitignore │ ├── README.md │ ├── dist_lenet.py │ ├── dist_sync_kvstore.py │ ├── download.sh │ ├── multi_lenet.py │ ├── sh2ju.sh │ ├── test_all.sh │ └── test_kvstore.py ├── python │ ├── README.md │ ├── common │ │ ├── get_data.py │ │ └── models.py │ ├── doctest │ │ └── run.py │ ├── gpu │ │ ├── test_forward.py │ │ ├── test_operator_gpu.py │ │ └── test_rtc.py │ ├── predict │ │ └── mxnet_predict_example.py │ ├── train │ │ ├── common.py │ │ ├── test_conv.py │ │ ├── test_dtype.py │ │ └── test_mlp.py │ └── unittest │ │ ├── common.py │ │ ├── test_attr.py │ │ ├── test_executor.py │ │ ├── test_infer_shape.py │ │ ├── test_io.py │ │ ├── test_kvstore.py │ │ ├── test_model_parallel.py │ │ ├── test_multi_device_exec.py │ │ ├── test_ndarray.py │ │ ├── test_operator.py │ │ ├── test_random.py │ │ ├── test_recordio.py │ │ └── test_symbol.py └── travis │ ├── is_core_changed.sh │ ├── r_vignettes.R │ ├── run_test.sh │ ├── setup.sh │ └── travis_after_failure.sh └── tools ├── accnn ├── README.md ├── acc_conv.py ├── acc_fc.py ├── accnn.py ├── config.json ├── rank_selection.py └── utils.py ├── bandwidth ├── .gitignore ├── README.md └── measure.py ├── caffe_converter ├── Makefile ├── README.md ├── caffe_parse │ ├── __init__.py │ ├── caffe.proto │ └── parse_from_protobuf.py ├── convert_model.py ├── convert_symbol.py ├── make_win32.bat ├── mean_image.py └── run.sh ├── cfn ├── Readme.md └── deeplearning.template ├── im2rec.cc ├── im2rec.py ├── kill-mxnet.py ├── launch.py └── parse_log.py /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "mshadow"] 2 | path = mshadow 3 | url = https://github.com/dmlc/mshadow.git 4 | [submodule "dmlc-core"] 5 | path = dmlc-core 6 | url = https://github.com/dmlc/dmlc-core.git 7 | [submodule "ps-lite"] 8 | path = ps-lite 9 | url = https://github.com/dmlc/ps-lite 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-2016 by Contributors 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /R-package/.Rbuildignore: -------------------------------------------------------------------------------- 1 | \.o$ 2 | src/*.so$ 3 | \.dll$ 4 | ^.*\.Rproj$ 5 | ^\.Rproj\.user$ 6 | 7 | README.md 8 | -------------------------------------------------------------------------------- /R-package/.gitignore: -------------------------------------------------------------------------------- 1 | .Rhistory 2 | R-package.Rproj 3 | *.Rproj 4 | *.o 5 | *.so 6 | *.html 7 | inst/doc 8 | -------------------------------------------------------------------------------- /R-package/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: mxnet 2 | Type: Package 3 | Title: MXNet 4 | Version: 0.7 5 | Date: 2015-12-23 6 | Author: Tianqi Chen, Qiang Kou, Tong He 7 | Maintainer: Qiang Kou 8 | Description: MXNet is a deep learning framework designed for both efficiency 9 | and flexibility. It allows you to mix the flavours of deep learning programs 10 | together to maximize the efficiency and your productivity. 11 | License: BSD 12 | URL: https://github.com/dmlc/mxnet/R-package 13 | BugReports: https://github.com/dmlc/mxnet/issues 14 | Imports: 15 | methods, 16 | Rcpp (>= 0.12.1), 17 | DiagrammeR (>= 0.8.1), 18 | data.table, 19 | jsonlite, 20 | magrittr, 21 | stringr 22 | Suggests: 23 | testthat, 24 | mlbench, 25 | knitr, 26 | rmarkdown, 27 | imager, 28 | roxygen2 29 | LinkingTo: Rcpp 30 | RoxygenNote: 5.0.1 31 | VignetteBuilder: knitr 32 | -------------------------------------------------------------------------------- /R-package/R/kvstore.R: -------------------------------------------------------------------------------- 1 | is.MXKVStore <- function(x) { 2 | inherits(x, "Rcpp_MXKVStore") 3 | } 4 | 5 | #' Create a mxnet KVStore. 6 | #' 7 | #' @param type string(default="local") The type of kvstore. 8 | #' @return The kvstore. 9 | #' 10 | #' @name mx.kv.create 11 | #' @export 12 | NULL 13 | -------------------------------------------------------------------------------- /R-package/R/util.R: -------------------------------------------------------------------------------- 1 | # Internal function to check if name end with suffix 2 | mx.util.str.endswith <- function(name, suffix) { 3 | slen <- nchar(suffix) 4 | nlen <- nchar(name) 5 | if (slen > nlen) return (FALSE) 6 | nsuf <- substr(name, nlen - slen + 1, nlen) 7 | return (nsuf == suffix) 8 | } 9 | 10 | mx.util.str.startswith <- function(name, prefix) { 11 | slen <- nchar(prefix) 12 | nlen <- nchar(name) 13 | if (slen > nlen) return (FALSE) 14 | npre <- substr(name, 1, slen) 15 | return (npre == prefix) 16 | } 17 | 18 | # filter out null, keep the names 19 | mx.util.filter.null <- function(lst) { 20 | lst[!sapply(lst, is.null)] 21 | } 22 | 23 | #' Internal function to generate mxnet_generated.R 24 | #' Users do not need to call this function. 25 | #' @param path The path to the root of the package. 26 | #' 27 | #' @export 28 | mxnet.export <- function(path) { 29 | mxnet.internal.export(path.expand(path)) 30 | } 31 | -------------------------------------------------------------------------------- /R-package/demo/00Index: -------------------------------------------------------------------------------- 1 | basic_bench Basic benchmark 2 | basic_executor Basic executor operations 3 | basic_kvstore Basic kvstore operations 4 | basic_model Basic model operations 5 | basic_ndarray Basic ndarray operations 6 | basic_random Basic random number generators 7 | basic_symbol Basic symbol operations 8 | -------------------------------------------------------------------------------- /R-package/demo/basic_bench.R: -------------------------------------------------------------------------------- 1 | require(mxnet) 2 | require(methods) 3 | 4 | 5 | shape = c(1, 1) 6 | lr = 0.01 7 | x = mx.nd.ones(shape) 8 | y = mx.nd.zeros(shape) 9 | print(x) 10 | n = 1000 11 | 12 | 13 | tic = proc.time() 14 | for (i in 1 : n) { 15 | y = y + x *lr 16 | } 17 | toc = proc.time() - tic 18 | as.array(y) 19 | print(toc) 20 | -------------------------------------------------------------------------------- /R-package/demo/basic_kvstore.R: -------------------------------------------------------------------------------- 1 | require(mxnet) 2 | 3 | kv = mx.kv.create() 4 | 5 | dlist = lapply(1:3, function(i) { 6 | x = as.array(c(i, i+1)) 7 | mat = mx.nd.array(x, mx.cpu(i)) 8 | list(x=mat) 9 | }) 10 | kv$init(c(0), dlist[[1]]) 11 | kv$push(c(0), dlist, 0) 12 | kv$pull(c(0), dlist, 0) 13 | 14 | print(as.array(dlist[[1]][[1]])) 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /R-package/demo/basic_ndarray.R: -------------------------------------------------------------------------------- 1 | require(mxnet) 2 | 3 | 4 | x = 1:3 5 | mat = mx.nd.array(x) 6 | 7 | 8 | mat = mat + 1.0 9 | mat = mat + mat 10 | mat = mat - 5 11 | mat = 10 / mat 12 | mat = 7 * mat 13 | mat = 1 - mat + (2 * mat)/(mat + 0.5) 14 | as.array(mat) 15 | 16 | x = as.array(matrix(1:4, 2, 2)) 17 | 18 | mx.ctx.default(mx.cpu(1)) 19 | print(mx.ctx.default()) 20 | print(is.mx.context(mx.cpu())) 21 | mat = mx.nd.array(x) 22 | mat = (mat * 3 + 5) / 10 23 | as.array(mat) 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /R-package/demo/basic_random.R: -------------------------------------------------------------------------------- 1 | require(mxnet) 2 | 3 | mx.set.seed(10) 4 | 5 | print(mx.runif(c(2,2), -10, 10)) 6 | 7 | # Test initialization module for neural nets. 8 | uinit = mx.init.uniform(0.1) 9 | print(uinit("fc1_weight", c(2, 2), mx.cpu())) 10 | print(uinit("fc1_gamma", c(2, 2), mx.cpu())) 11 | -------------------------------------------------------------------------------- /R-package/demo/basic_symbol.R: -------------------------------------------------------------------------------- 1 | require(mxnet) 2 | 3 | data = mx.symbol.Variable('data') 4 | net1 = mx.symbol.FullyConnected(data=data, name='fc1', num_hidden=10) 5 | net1 = mx.symbol.FullyConnected(data=net1, name='fc2', num_hidden=100) 6 | 7 | all.equal(arguments(net1), c('data', 'fc1_weight', 'fc1_bias', 'fc2_weight', 'fc2_bias')) 8 | 9 | net2 = mx.symbol.FullyConnected(name='fc3', num_hidden=10) 10 | net2 = mx.symbol.Activation(data=net2, act_type='relu') 11 | net2 = mx.symbol.FullyConnected(data=net2, name='fc4', num_hidden=20) 12 | 13 | composed = mx.apply(net2, fc3_data=net1, name='composed') 14 | -------------------------------------------------------------------------------- /R-package/man/Ops.MXNDArray.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{Ops.MXNDArray} 4 | \alias{Ops.MXNDArray} 5 | \title{Binary operator overloading of mx.ndarray} 6 | \usage{ 7 | \method{Ops}{MXNDArray}(e1, e2) 8 | } 9 | \arguments{ 10 | \item{e1}{The first operand} 11 | 12 | \item{e1}{The second operand} 13 | } 14 | \description{ 15 | Binary operator overloading of mx.ndarray 16 | } 17 | 18 | -------------------------------------------------------------------------------- /R-package/man/arguments.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/symbol.R 3 | \name{arguments} 4 | \alias{arguments} 5 | \title{Get the arguments of symbol.} 6 | \usage{ 7 | arguments(x) 8 | } 9 | \arguments{ 10 | \item{x}{The input symbol} 11 | } 12 | \description{ 13 | Get the arguments of symbol. 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/as.array.MXNDArray.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{as.array.MXNDArray} 4 | \alias{as.array.MXNDArray} 5 | \title{as.array operator overload of mx.ndarray} 6 | \usage{ 7 | \method{as.array}{MXNDArray}(nd) 8 | } 9 | \arguments{ 10 | \item{nd}{The mx.ndarray} 11 | } 12 | \description{ 13 | as.array operator overload of mx.ndarray 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/as.matrix.MXNDArray.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{as.matrix.MXNDArray} 4 | \alias{as.matrix.MXNDArray} 5 | \title{as.matrix operator overload of mx.ndarray} 6 | \usage{ 7 | \method{as.matrix}{MXNDArray}(nd) 8 | } 9 | \arguments{ 10 | \item{nd}{The mx.ndarray} 11 | } 12 | \description{ 13 | as.matrix operator overload of mx.ndarray 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/ctx.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{ctx} 4 | \alias{ctx} 5 | \title{Get the context of mx.ndarray} 6 | \usage{ 7 | ctx(nd) 8 | } 9 | \arguments{ 10 | \item{nd}{The mx.ndarray} 11 | } 12 | \description{ 13 | Get the context of mx.ndarray 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/dim.MXNDArray.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{dim.MXNDArray} 4 | \alias{dim.MXNDArray} 5 | \title{Dimension operator overload of mx.ndarray} 6 | \usage{ 7 | \method{dim}{MXNDArray}(nd) 8 | } 9 | \arguments{ 10 | \item{nd}{The mx.ndarray} 11 | } 12 | \description{ 13 | Dimension operator overload of mx.ndarray 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/is.mx.context.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/context.R 3 | \name{is.mx.context} 4 | \alias{is.mx.context} 5 | \title{Check if the type is mxnet context.} 6 | \usage{ 7 | is.mx.context(x) 8 | } 9 | \value{ 10 | Logical indicator 11 | } 12 | \description{ 13 | Check if the type is mxnet context. 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/is.mx.dataiter.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/io.R 3 | \name{is.mx.dataiter} 4 | \alias{is.mx.dataiter} 5 | \title{Judge if an object is mx.dataiter} 6 | \usage{ 7 | is.mx.dataiter(x) 8 | } 9 | \value{ 10 | Logical indicator 11 | } 12 | \description{ 13 | Judge if an object is mx.dataiter 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/is.mx.ndarray.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{is.mx.ndarray} 4 | \alias{is.mx.ndarray} 5 | \title{Check if src.array is mx.ndarray} 6 | \usage{ 7 | is.mx.ndarray(src.array) 8 | } 9 | \value{ 10 | Logical indicator 11 | } 12 | \description{ 13 | Check if src.array is mx.ndarray 14 | } 15 | \examples{ 16 | mat = mx.nd.array(1:10) 17 | is.mx.ndarray(mat) 18 | mat2 = 1:10 19 | is.mx.ndarray(mat2) 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/is.mx.symbol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/symbol.R 3 | \name{is.mx.symbol} 4 | \alias{is.mx.symbol} 5 | \title{Judge if an object is mx.symbol} 6 | \usage{ 7 | is.mx.symbol(x) 8 | } 9 | \value{ 10 | Logical indicator 11 | } 12 | \description{ 13 | Judge if an object is mx.symbol 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/length.MXNDArray.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{length.MXNDArray} 4 | \alias{length.MXNDArray} 5 | \title{Length operator overload of mx.ndarray} 6 | \usage{ 7 | \method{length}{MXNDArray}(nd) 8 | } 9 | \arguments{ 10 | \item{nd}{The mx.ndarray} 11 | } 12 | \description{ 13 | Length operator overload of mx.ndarray 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.apply.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/symbol.R 3 | \name{mx.apply} 4 | \alias{mx.apply} 5 | \title{Apply symbol to the inputs.} 6 | \usage{ 7 | mx.apply(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{The symbol to be applied} 11 | 12 | \item{kwargs}{The keyword arguments to the symbol} 13 | } 14 | \description{ 15 | Apply symbol to the inputs. 16 | } 17 | 18 | -------------------------------------------------------------------------------- /R-package/man/mx.callback.log.train.metric.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/callback.R 3 | \name{mx.callback.log.train.metric} 4 | \alias{mx.callback.log.train.metric} 5 | \title{Log training metric each period} 6 | \usage{ 7 | mx.callback.log.train.metric(period, logger = NULL) 8 | } 9 | \arguments{ 10 | \item{period}{The number of batch to log the training evaluation metric} 11 | 12 | \item{logger}{The logger class} 13 | } 14 | \description{ 15 | Log training metric each period 16 | } 17 | 18 | -------------------------------------------------------------------------------- /R-package/man/mx.callback.save.checkpoint.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/callback.R 3 | \name{mx.callback.save.checkpoint} 4 | \alias{mx.callback.save.checkpoint} 5 | \title{Save checkpoint to files each period iteration.} 6 | \usage{ 7 | mx.callback.save.checkpoint(prefix, period = 1) 8 | } 9 | \arguments{ 10 | \item{prefix}{The prefix of the model checkpoint.} 11 | } 12 | \description{ 13 | Save checkpoint to files each period iteration. 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.cpu.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/context.R 3 | \name{mx.cpu} 4 | \alias{mx.cpu} 5 | \title{Create a mxnet CPU context.} 6 | \arguments{ 7 | \item{dev.id}{optional, default=0 8 | The device ID, this is meaningless for CPU, included for interface compatiblity.} 9 | } 10 | \value{ 11 | The CPU context. 12 | } 13 | \description{ 14 | Create a mxnet CPU context. 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.ctx.default.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/context.R 3 | \name{mx.ctx.default} 4 | \alias{mx.ctx.default} 5 | \title{Set/Get default context for array creation.} 6 | \usage{ 7 | mx.ctx.default(new = NULL) 8 | } 9 | \arguments{ 10 | \item{new, }{optional takes \code{mx.cpu()} or \code{mx.gpu(id)}, new default ctx.} 11 | } 12 | \value{ 13 | The default context. 14 | } 15 | \description{ 16 | Set/Get default context for array creation. 17 | } 18 | 19 | -------------------------------------------------------------------------------- /R-package/man/mx.exec.backward.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/executor.R 3 | \name{mx.exec.backward} 4 | \alias{mx.exec.backward} 5 | \title{Peform an backward on the executors 6 | This function will MUTATE the state of exec} 7 | \usage{ 8 | mx.exec.backward(exec, ...) 9 | } 10 | \description{ 11 | Peform an backward on the executors 12 | This function will MUTATE the state of exec 13 | } 14 | 15 | -------------------------------------------------------------------------------- /R-package/man/mx.exec.forward.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/executor.R 3 | \name{mx.exec.forward} 4 | \alias{mx.exec.forward} 5 | \title{Peform an forward on the executors 6 | This function will MUTATE the state of exec} 7 | \usage{ 8 | mx.exec.forward(exec, is.train = TRUE) 9 | } 10 | \description{ 11 | Peform an forward on the executors 12 | This function will MUTATE the state of exec 13 | } 14 | 15 | -------------------------------------------------------------------------------- /R-package/man/mx.exec.update.arg.arrays.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/executor.R 3 | \name{mx.exec.update.arg.arrays} 4 | \alias{mx.exec.update.arg.arrays} 5 | \title{Update the executors with new arrays 6 | This function will MUTATE the state of exec} 7 | \usage{ 8 | mx.exec.update.arg.arrays(exec, arg.arrays, match.name = FALSE, 9 | skip.null = FALSE) 10 | } 11 | \description{ 12 | Update the executors with new arrays 13 | This function will MUTATE the state of exec 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.exec.update.aux.arrays.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/executor.R 3 | \name{mx.exec.update.aux.arrays} 4 | \alias{mx.exec.update.aux.arrays} 5 | \title{Update the executors with new arrays 6 | This function will MUTATE the state of exec} 7 | \usage{ 8 | mx.exec.update.aux.arrays(exec, arg.arrays, match.name = FALSE, 9 | skip.null = FALSE) 10 | } 11 | \description{ 12 | Update the executors with new arrays 13 | This function will MUTATE the state of exec 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.exec.update.grad.arrays.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/executor.R 3 | \name{mx.exec.update.grad.arrays} 4 | \alias{mx.exec.update.grad.arrays} 5 | \title{Update the executors with new arrays 6 | This function will MUTATE the state of exec} 7 | \usage{ 8 | mx.exec.update.grad.arrays(exec, arg.arrays, match.name = FALSE, 9 | skip.null = FALSE) 10 | } 11 | \description{ 12 | Update the executors with new arrays 13 | This function will MUTATE the state of exec 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.gpu.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/context.R 3 | \name{mx.gpu} 4 | \alias{mx.gpu} 5 | \title{Create a mxnet GPU context.} 6 | \arguments{ 7 | \item{dev.id}{optional, default=0 8 | The GPU device ID, starts from 0.} 9 | } 10 | \value{ 11 | The GPU context. 12 | } 13 | \description{ 14 | Create a mxnet GPU context. 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.gru.forward.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gru.R 3 | \name{mx.gru.forward} 4 | \alias{mx.gru.forward} 5 | \title{Using forward function to predict in gru inference model} 6 | \usage{ 7 | mx.gru.forward(model, input.data, new.seq = FALSE) 8 | } 9 | \arguments{ 10 | \item{model}{gru model 11 | A gru inference model} 12 | 13 | \item{input.data, }{array.matrix 14 | The input data for forward function} 15 | 16 | \item{new.seq}{boolean, default=FALSE 17 | Whether the input is the start of a new sequence} 18 | } 19 | \value{ 20 | result A list(prob=prob, model=model) containing the result probability of each label and the model. 21 | } 22 | \description{ 23 | Using forward function to predict in gru inference model 24 | } 25 | 26 | -------------------------------------------------------------------------------- /R-package/man/mx.init.Xavier.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/initializer.R 3 | \name{mx.init.Xavier} 4 | \alias{mx.init.Xavier} 5 | \title{Xavier initializer} 6 | \usage{ 7 | mx.init.Xavier(rnd_type = "uniform", factor_type = "avg", magnitude = 3) 8 | } 9 | \arguments{ 10 | \item{rnd_type}{A string of \code{character} indicating the type of 11 | distribution from which the weights are initialized.} 12 | 13 | \item{factor_type}{A string of \code{character}.} 14 | 15 | \item{magnitude}{A \code{numeric} number indicating the scale of random 16 | number range.} 17 | } 18 | \description{ 19 | Create a initializer which initialize weight with Xavier or 20 | similar initialization scheme. 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.init.create.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/initializer.R 3 | \name{mx.init.create} 4 | \alias{mx.init.create} 5 | \title{Create initialization of argument like arg.array} 6 | \usage{ 7 | mx.init.create(initializer, shape.array, ctx, skip.unknown = TRUE) 8 | } 9 | \arguments{ 10 | \item{initializer}{The initializer.} 11 | 12 | \item{shape.array}{named-list The shape of the weights} 13 | 14 | \item{ctx}{mx.context The context of the weights} 15 | 16 | \item{skip.unknown}{Whether skip the unknown weight types} 17 | } 18 | \description{ 19 | Create initialization of argument like arg.array 20 | } 21 | 22 | -------------------------------------------------------------------------------- /R-package/man/mx.init.internal.default.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/initializer.R 3 | \name{mx.init.internal.default} 4 | \alias{mx.init.internal.default} 5 | \title{Internal default value initialization scheme.} 6 | \usage{ 7 | mx.init.internal.default(name, shape, ctx, allow.unknown = FALSE) 8 | } 9 | \arguments{ 10 | \item{name}{the name of the variable.} 11 | 12 | \item{shape}{the shape of the array to be generated.} 13 | } 14 | \description{ 15 | Internal default value initialization scheme. 16 | } 17 | 18 | -------------------------------------------------------------------------------- /R-package/man/mx.init.normal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/initializer.R 3 | \name{mx.init.normal} 4 | \alias{mx.init.normal} 5 | \title{Create a initializer that initialize the weight with normal(0, sd)} 6 | \usage{ 7 | mx.init.normal(sd) 8 | } 9 | \arguments{ 10 | \item{sd}{The standard deviation of normal distribution} 11 | } 12 | \description{ 13 | Create a initializer that initialize the weight with normal(0, sd) 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.init.uniform.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/initializer.R 3 | \name{mx.init.uniform} 4 | \alias{mx.init.uniform} 5 | \title{Create a initializer that initialize the weight with uniform [-scale, scale]} 6 | \usage{ 7 | mx.init.uniform(scale) 8 | } 9 | \arguments{ 10 | \item{scale}{The scale of uniform distribution} 11 | } 12 | \description{ 13 | Create a initializer that initialize the weight with uniform [-scale, scale] 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.io.CSVIter.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.io.CSVIter} 4 | \alias{mx.io.CSVIter} 5 | \title{Create iterator for dataset in csv.} 6 | \usage{ 7 | mx.io.CSVIter(...) 8 | } 9 | \arguments{ 10 | \item{data.csv}{string, required 11 | Dataset Param: Data csv path.} 12 | 13 | \item{data.shape}{Shape(tuple), required 14 | Dataset Param: Shape of the data.} 15 | 16 | \item{label.csv}{string, optional, default='NULL' 17 | Dataset Param: Label csv path. If is NULL, all labels will be returned as 0} 18 | 19 | \item{label.shape}{Shape(tuple), optional, default=(1,) 20 | Dataset Param: Shape of the label.} 21 | } 22 | \value{ 23 | iter The result mx.dataiter 24 | } 25 | \description{ 26 | Create iterator for dataset in csv. 27 | } 28 | 29 | -------------------------------------------------------------------------------- /R-package/man/mx.io.arrayiter.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/io.R 3 | \name{mx.io.arrayiter} 4 | \alias{mx.io.arrayiter} 5 | \title{Create MXDataIter compatible iterator from R's array} 6 | \usage{ 7 | mx.io.arrayiter(data, label, batch.size = 128, shuffle = FALSE) 8 | } 9 | \arguments{ 10 | \item{data}{The data array.} 11 | 12 | \item{label}{The label array.} 13 | 14 | \item{batch.size}{The batch size used to pack the array.} 15 | 16 | \item{shuffle}{Whether shuffle the data} 17 | } 18 | \description{ 19 | Create MXDataIter compatible iterator from R's array 20 | } 21 | 22 | -------------------------------------------------------------------------------- /R-package/man/mx.io.extract.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/io.R 3 | \name{mx.io.extract} 4 | \alias{mx.io.extract} 5 | \title{Extract a certain field from DataIter.} 6 | \usage{ 7 | mx.io.extract(iter, field) 8 | } 9 | \description{ 10 | Extract a certain field from DataIter. 11 | } 12 | 13 | -------------------------------------------------------------------------------- /R-package/man/mx.kv.create.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/kvstore.R 3 | \name{mx.kv.create} 4 | \alias{mx.kv.create} 5 | \title{Create a mxnet KVStore.} 6 | \arguments{ 7 | \item{type}{string(default="local") The type of kvstore.} 8 | } 9 | \value{ 10 | The kvstore. 11 | } 12 | \description{ 13 | Create a mxnet KVStore. 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.lstm.forward.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lstm.R 3 | \name{mx.lstm.forward} 4 | \alias{mx.lstm.forward} 5 | \title{Using forward function to predict in lstm inference model} 6 | \usage{ 7 | mx.lstm.forward(model, input.data, new.seq = FALSE) 8 | } 9 | \arguments{ 10 | \item{model}{lstm model 11 | A Lstm inference model} 12 | 13 | \item{input.data, }{array.matrix 14 | The input data for forward function} 15 | 16 | \item{new.seq}{boolean, default=FALSE 17 | Whether the input is the start of a new sequence} 18 | } 19 | \value{ 20 | result A list(prob=prob, model=model) containing the result probability of each label and the model. 21 | } 22 | \description{ 23 | Using forward function to predict in lstm inference model 24 | } 25 | 26 | -------------------------------------------------------------------------------- /R-package/man/mx.metric.accuracy.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metric.R 3 | \docType{data} 4 | \name{mx.metric.accuracy} 5 | \alias{mx.metric.accuracy} 6 | \title{Accuracy metric for classification} 7 | \format{An object of class \code{mx.metric} of length 3.} 8 | \usage{ 9 | mx.metric.accuracy 10 | } 11 | \description{ 12 | Accuracy metric for classification 13 | } 14 | \keyword{datasets} 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.metric.custom.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metric.R 3 | \name{mx.metric.custom} 4 | \alias{mx.metric.custom} 5 | \title{Helper function to create a customized metric} 6 | \usage{ 7 | mx.metric.custom(name, feval) 8 | } 9 | \description{ 10 | Helper function to create a customized metric 11 | } 12 | 13 | -------------------------------------------------------------------------------- /R-package/man/mx.metric.mae.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metric.R 3 | \docType{data} 4 | \name{mx.metric.mae} 5 | \alias{mx.metric.mae} 6 | \title{MAE (Mean Absolute Error) metric for regression} 7 | \format{An object of class \code{mx.metric} of length 3.} 8 | \usage{ 9 | mx.metric.mae 10 | } 11 | \description{ 12 | MAE (Mean Absolute Error) metric for regression 13 | } 14 | \keyword{datasets} 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.metric.rmse.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metric.R 3 | \docType{data} 4 | \name{mx.metric.rmse} 5 | \alias{mx.metric.rmse} 6 | \title{RMSE (Root Mean Squared Error) metric for regression} 7 | \format{An object of class \code{mx.metric} of length 3.} 8 | \usage{ 9 | mx.metric.rmse 10 | } 11 | \description{ 12 | RMSE (Root Mean Squared Error) metric for regression 13 | } 14 | \keyword{datasets} 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.metric.rmsle.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metric.R 3 | \docType{data} 4 | \name{mx.metric.rmsle} 5 | \alias{mx.metric.rmsle} 6 | \title{RMSLE (Root Mean Squared Logarithmic Error) metric for regression} 7 | \format{An object of class \code{mx.metric} of length 3.} 8 | \usage{ 9 | mx.metric.rmsle 10 | } 11 | \description{ 12 | RMSLE (Root Mean Squared Logarithmic Error) metric for regression 13 | } 14 | \keyword{datasets} 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.model.load.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/model.R 3 | \name{mx.model.load} 4 | \alias{mx.model.load} 5 | \title{Load model checkpoint from file.} 6 | \usage{ 7 | mx.model.load(prefix, iteration) 8 | } 9 | \arguments{ 10 | \item{prefix}{string prefix of the model name} 11 | 12 | \item{iteration}{integer Iteration number of model we would like to load.} 13 | } 14 | \description{ 15 | Load model checkpoint from file. 16 | } 17 | 18 | -------------------------------------------------------------------------------- /R-package/man/mx.model.save.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/model.R 3 | \name{mx.model.save} 4 | \alias{mx.model.save} 5 | \title{Save model checkpoint into file.} 6 | \usage{ 7 | mx.model.save(model, prefix, iteration) 8 | } 9 | \arguments{ 10 | \item{model}{The feedforward model to be saved.} 11 | 12 | \item{prefix}{string prefix of the model name} 13 | 14 | \item{iteration}{integer Iteration number of model we would like to load.} 15 | } 16 | \description{ 17 | Save model checkpoint into file. 18 | } 19 | 20 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.abs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.abs} 4 | \alias{mx.nd.abs} 5 | \title{Take absolute value of the src} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take absolute value of the src 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.argmax.channel.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.argmax.channel} 4 | \alias{mx.nd.argmax.channel} 5 | \title{Take argmax indices of each channel of the src.The result will be ndarray of shape (num_channel,) on the same device.} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take argmax indices of each channel of the src.The result will be ndarray of shape (num_channel,) on the same device. 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.array.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{mx.nd.array} 4 | \alias{mx.nd.array} 5 | \title{Create a new \code{mx.ndarray} that copies the content from src on ctx.} 6 | \usage{ 7 | mx.nd.array(src.array, ctx = NULL) 8 | } 9 | \arguments{ 10 | \item{src.array}{Source array data of class \code{array}, \code{vector} or \code{matrix}.} 11 | 12 | \item{ctx}{optional The context device of the array. mx.ctx.default() will be used in default.} 13 | } 14 | \value{ 15 | An \code{mx.ndarray} 16 | 17 | An Rcpp_MXNDArray object 18 | } 19 | \description{ 20 | Create a new \code{mx.ndarray} that copies the content from src on ctx. 21 | } 22 | \examples{ 23 | mat = mx.nd.array(x) 24 | mat = 1 - mat + (2 * mat)/(mat + 0.5) 25 | as.array(mat) 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.ceil.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.ceil} 4 | \alias{mx.nd.ceil} 5 | \title{Take ceil value of the src} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take ceil value of the src 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.choose.element.0index.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.choose.element.0index} 4 | \alias{mx.nd.choose.element.0index} 5 | \title{Choose one element from each line(row for python, column for R/Julia) in lhs according to index indicated by rhs. This function assume rhs uses 0-based index.} 6 | \arguments{ 7 | \item{lhs}{NDArray 8 | Left operand to the function.} 9 | 10 | \item{rhs}{NDArray 11 | Right operand to the function.} 12 | } 13 | \value{ 14 | out The result mx.ndarray 15 | } 16 | \description{ 17 | Choose one element from each line(row for python, column for R/Julia) in lhs according to index indicated by rhs. This function assume rhs uses 0-based index. 18 | } 19 | 20 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.clip.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.clip} 4 | \alias{mx.nd.clip} 5 | \title{Clip ndarray elements to range (a_min, a_max)} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input} 9 | 10 | \item{a.min}{real_t 11 | Minimum value} 12 | 13 | \item{a.max}{real_t 14 | Maximum value} 15 | } 16 | \value{ 17 | out The result mx.ndarray 18 | } 19 | \description{ 20 | Clip ndarray elements to range (a_min, a_max) 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.copyto.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{mx.nd.copyto} 4 | \alias{mx.nd.copyto} 5 | \title{Generate an mx.ndarray object on ctx, with data copied from src} 6 | \usage{ 7 | mx.nd.copyto(src, ctx) 8 | } 9 | \arguments{ 10 | \item{src}{The source mx.ndarray object.} 11 | 12 | \item{ctx}{The target context.} 13 | } 14 | \description{ 15 | Generate an mx.ndarray object on ctx, with data copied from src 16 | } 17 | 18 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.cos.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.cos} 4 | \alias{mx.nd.cos} 5 | \title{Take cos of the src} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take cos of the src 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.dot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.dot} 4 | \alias{mx.nd.dot} 5 | \title{Calculate dot product of two matrices or two vectors} 6 | \arguments{ 7 | \item{lhs}{NDArray 8 | Left operand to the function} 9 | 10 | \item{rhs}{NDArray 11 | Right operand to the function} 12 | } 13 | \value{ 14 | out The result mx.ndarray 15 | } 16 | \description{ 17 | Calculate dot product of two matrices or two vectors 18 | } 19 | 20 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.exp.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.exp} 4 | \alias{mx.nd.exp} 5 | \title{Take exp of the src} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take exp of the src 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.fill.element.0index.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.fill.element.0index} 4 | \alias{mx.nd.fill.element.0index} 5 | \title{Fill one element of each line(row for python, column for R/Julia) in lhs according to index indicated by rhs and values indicated by mhs. This function assume rhs uses 0-based index.} 6 | \arguments{ 7 | \item{lhs}{NDArray 8 | Left operand to the function.} 9 | 10 | \item{mhs}{NDArray 11 | Middle operand to the function.} 12 | 13 | \item{rhs}{NDArray 14 | Right operand to the function.} 15 | } 16 | \value{ 17 | out The result mx.ndarray 18 | } 19 | \description{ 20 | Fill one element of each line(row for python, column for R/Julia) in lhs according to index indicated by rhs and values indicated by mhs. This function assume rhs uses 0-based index. 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.floor.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.floor} 4 | \alias{mx.nd.floor} 5 | \title{Take floor value of the src} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take floor value of the src 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.load.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{mx.nd.load} 4 | \alias{mx.nd.load} 5 | \title{Load an mx.nd.array object on disk} 6 | \usage{ 7 | mx.nd.load(filename) 8 | } 9 | \arguments{ 10 | \item{filename}{the filename (including the path)} 11 | } 12 | \description{ 13 | Load an mx.nd.array object on disk 14 | } 15 | \examples{ 16 | mat = mx.nd.array(1:3) 17 | mx.nd.save(mat, 'temp.mat') 18 | mat2 = mx.nd.load('temp.mat') 19 | as.array(mat) 20 | as.array(mat2) 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.log.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.log} 4 | \alias{mx.nd.log} 5 | \title{Take log of the src} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take log of the src 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.max.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.max} 4 | \alias{mx.nd.max} 5 | \title{Take max of the src in the given axis and returns a NDArray. Follows numpy semantics.} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | 10 | \item{axis}{Shape(tuple), optional, default=() 11 | Same as Numpy. The axes to perform the reduction.If left empty, a global reduction will be performed.} 12 | 13 | \item{keepdims}{boolean, optional, default=False 14 | Same as Numpy. If keepdims is set to true, the axis which is reduced is left in the result as dimension with size one.} 15 | } 16 | \value{ 17 | out The result mx.ndarray 18 | } 19 | \description{ 20 | Take max of the src in the given axis and returns a NDArray. Follows numpy semantics. 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.min.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.min} 4 | \alias{mx.nd.min} 5 | \title{Take min of the src in the given axis and returns a NDArray. Follows numpy semantics.} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | 10 | \item{axis}{Shape(tuple), optional, default=() 11 | Same as Numpy. The axes to perform the reduction.If left empty, a global reduction will be performed.} 12 | 13 | \item{keepdims}{boolean, optional, default=False 14 | Same as Numpy. If keepdims is set to true, the axis which is reduced is left in the result as dimension with size one.} 15 | } 16 | \value{ 17 | out The result mx.ndarray 18 | } 19 | \description{ 20 | Take min of the src in the given axis and returns a NDArray. Follows numpy semantics. 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.norm.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.norm} 4 | \alias{mx.nd.norm} 5 | \title{Take L2 norm of the src.The result will be ndarray of shape (1,) on the same device.} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take L2 norm of the src.The result will be ndarray of shape (1,) on the same device. 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.ones.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{mx.nd.ones} 4 | \alias{mx.nd.ones} 5 | \title{Generate an mx.ndarray object with ones} 6 | \usage{ 7 | mx.nd.ones(shape, ctx = NULL) 8 | } 9 | \arguments{ 10 | \item{shape}{the dimension of the \code{mx.ndarray}} 11 | 12 | \item{ctx}{optional The context device of the array. mx.ctx.default() will be used in default.} 13 | } 14 | \description{ 15 | Generate an mx.ndarray object with ones 16 | } 17 | \examples{ 18 | mat = mx.nd.ones(10) 19 | as.array(mat) 20 | mat2 = mx.nd.ones(c(5,5)) 21 | as.array(mat) 22 | mat3 = mx.nd.ones(c(3,3,3)) 23 | as.array(mat3) 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.round.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.round} 4 | \alias{mx.nd.round} 5 | \title{Take round value of the src} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take round value of the src 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.rsqrt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.rsqrt} 4 | \alias{mx.nd.rsqrt} 5 | \title{Take rsqrt of the src} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take rsqrt of the src 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.save.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{mx.nd.save} 4 | \alias{mx.nd.save} 5 | \title{Save an mx.nd.array object} 6 | \usage{ 7 | mx.nd.save(ndarray, filename) 8 | } 9 | \arguments{ 10 | \item{ndarray}{the \code{mx.nd.array} object} 11 | 12 | \item{filename}{the filename (including the path)} 13 | } 14 | \description{ 15 | Save an mx.nd.array object 16 | } 17 | \examples{ 18 | mat = mx.nd.array(1:3) 19 | mx.nd.save(mat, 'temp.mat') 20 | mat2 = mx.nd.load('temp.mat') 21 | as.array(mat) 22 | as.array(mat2[[1]]) 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.sign.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.sign} 4 | \alias{mx.nd.sign} 5 | \title{Take sign value of the src} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take sign value of the src 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.sin.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.sin} 4 | \alias{mx.nd.sin} 5 | \title{Take sin of the src} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take sin of the src 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.sqrt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.sqrt} 4 | \alias{mx.nd.sqrt} 5 | \title{Take sqrt of the src} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take sqrt of the src 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.square.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.square} 4 | \alias{mx.nd.square} 5 | \title{Take square of the src} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | } 10 | \value{ 11 | out The result mx.ndarray 12 | } 13 | \description{ 14 | Take square of the src 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.sum.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.nd.sum} 4 | \alias{mx.nd.sum} 5 | \title{Take sum of the src in the given axis and returns a NDArray. Follows numpy semantics.} 6 | \arguments{ 7 | \item{src}{NDArray 8 | Source input to the function} 9 | 10 | \item{axis}{Shape(tuple), optional, default=() 11 | Same as Numpy. The axes to perform the reduction.If left empty, a global reduction will be performed.} 12 | 13 | \item{keepdims}{boolean, optional, default=False 14 | Same as Numpy. If keepdims is set to true, the axis which is reduced is left in the result as dimension with size one.} 15 | } 16 | \value{ 17 | out The result mx.ndarray 18 | } 19 | \description{ 20 | Take sum of the src in the given axis and returns a NDArray. Follows numpy semantics. 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.nd.zeros.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{mx.nd.zeros} 4 | \alias{mx.nd.zeros} 5 | \title{Generate an mx.nd.array object with zeros} 6 | \usage{ 7 | mx.nd.zeros(shape, ctx = NULL) 8 | } 9 | \arguments{ 10 | \item{shape}{the dimension of the \code{mx.nd.array}} 11 | 12 | \item{ctx}{optional The context device of the array. mx.ctx.default() will be used in default.} 13 | } 14 | \description{ 15 | Generate an mx.nd.array object with zeros 16 | } 17 | \examples{ 18 | mat = mx.nd.zeros(10) 19 | as.array(mat) 20 | mat2 = mx.nd.zeros(c(5,5)) 21 | as.array(mat) 22 | mat3 = mx.nd.zeroes(c(3,3,3)) 23 | as.array(mat3) 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /R-package/man/mx.opt.create.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/optimizer.R 3 | \name{mx.opt.create} 4 | \alias{mx.opt.create} 5 | \title{Create an optimizer by name and parameters} 6 | \usage{ 7 | mx.opt.create(name, ...) 8 | } 9 | \arguments{ 10 | \item{name}{The name of the optimizer} 11 | 12 | \item{...}{Additional arguments} 13 | } 14 | \description{ 15 | Create an optimizer by name and parameters 16 | } 17 | 18 | -------------------------------------------------------------------------------- /R-package/man/mx.opt.get.updater.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/optimizer.R 3 | \name{mx.opt.get.updater} 4 | \alias{mx.opt.get.updater} 5 | \title{Get an updater closure that can take list of weight and gradient 6 | and return updated list of weight.} 7 | \usage{ 8 | mx.opt.get.updater(optimizer, weights) 9 | } 10 | \arguments{ 11 | \item{optimizer}{The optimizer} 12 | 13 | \item{weights}{The weights to be optimized} 14 | } 15 | \description{ 16 | Get an updater closure that can take list of weight and gradient 17 | and return updated list of weight. 18 | } 19 | 20 | -------------------------------------------------------------------------------- /R-package/man/mx.opt.sgd.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/optimizer.R 3 | \name{mx.opt.sgd} 4 | \alias{mx.opt.sgd} 5 | \title{Create an SGD optimizer with respective parameters. 6 | Perform SGD with momentum update} 7 | \usage{ 8 | mx.opt.sgd(learning.rate, momentum = 0, wd = 0, rescale.grad = 1, 9 | clip_gradient = NULL, lr_scheduler = NULL) 10 | } 11 | \description{ 12 | Create an SGD optimizer with respective parameters. 13 | Perform SGD with momentum update 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.rnn.forward.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rnn.R 3 | \name{mx.rnn.forward} 4 | \alias{mx.rnn.forward} 5 | \title{Using forward function to predict in rnn inference model} 6 | \usage{ 7 | mx.rnn.forward(model, input.data, new.seq = FALSE) 8 | } 9 | \arguments{ 10 | \item{model}{rnn model 11 | A rnn inference model} 12 | 13 | \item{input.data, }{array.matrix 14 | The input data for forward function} 15 | 16 | \item{new.seq}{boolean, default=FALSE 17 | Whether the input is the start of a new sequence} 18 | } 19 | \value{ 20 | result A list(prob=prob, model=model) containing the result probability of each label and the model. 21 | } 22 | \description{ 23 | Using forward function to predict in rnn inference model 24 | } 25 | 26 | -------------------------------------------------------------------------------- /R-package/man/mx.rnorm.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/random.R 3 | \name{mx.rnorm} 4 | \alias{mx.rnorm} 5 | \title{Generate nomal distribution with mean and sd.} 6 | \usage{ 7 | mx.rnorm(shape, mean = 0, sd = 1, ctx = NULL) 8 | } 9 | \arguments{ 10 | \item{shape}{Dimension, The shape(dimension) of the result.} 11 | 12 | \item{mean}{numeric, The mean of distribution.} 13 | 14 | \item{sd}{numeric, The standard deviations.} 15 | 16 | \item{ctx, }{optional The context device of the array. mx.ctx.default() will be used in default.} 17 | } 18 | \description{ 19 | Generate nomal distribution with mean and sd. 20 | } 21 | \examples{ 22 | 23 | mx.set.seed(0) 24 | as.array(mx.runif(2)) 25 | # 0.5488135 0.5928446 26 | mx.set.seed(0) 27 | as.array(mx.rnorm(2)) 28 | # 2.212206 1.163079 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /R-package/man/mx.runif.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/random.R 3 | \name{mx.runif} 4 | \alias{mx.runif} 5 | \title{Generate uniform distribution in [low, high) with specified shape.} 6 | \usage{ 7 | mx.runif(shape, min = 0, max = 1, ctx = NULL) 8 | } 9 | \arguments{ 10 | \item{shape}{Dimension, The shape(dimension) of the result.} 11 | 12 | \item{min}{numeric, The lower bound of distribution.} 13 | 14 | \item{max}{numeric, The upper bound of distribution.} 15 | 16 | \item{ctx, }{optional The context device of the array. mx.ctx.default() will be used in default.} 17 | } 18 | \description{ 19 | Generate uniform distribution in [low, high) with specified shape. 20 | } 21 | \examples{ 22 | 23 | mx.set.seed(0) 24 | as.array(mx.runif(2)) 25 | # 0.5488135 0.5928446 26 | mx.set.seed(0) 27 | as.array(mx.rnorm(2)) 28 | # 2.212206 1.163079 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /R-package/man/mx.simple.bind.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/executor.R 3 | \name{mx.simple.bind} 4 | \alias{mx.simple.bind} 5 | \title{Simple bind the symbol to executor, 6 | with information from input shapes.} 7 | \usage{ 8 | mx.simple.bind(symbol, ctx, grad.req = "null", ...) 9 | } 10 | \description{ 11 | Simple bind the symbol to executor, 12 | with information from input shapes. 13 | } 14 | 15 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.Activation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.Activation} 4 | \alias{mx.symbol.Activation} 5 | \title{Apply activation function to input.Softmax Activation is only available with CUDNN on GPUand will be computed at each location across channel if input is 4D.} 6 | \usage{ 7 | mx.symbol.Activation(...) 8 | } 9 | \arguments{ 10 | \item{data}{Symbol 11 | Input data to activation function.} 12 | 13 | \item{act.type}{{'relu', 'sigmoid', 'softrelu', 'tanh'}, required 14 | Activation function to be applied.} 15 | 16 | \item{name}{string, optional 17 | Name of the resulting symbol.} 18 | } 19 | \value{ 20 | out The result mx.symbol 21 | } 22 | \description{ 23 | Apply activation function to input.Softmax Activation is only available with CUDNN on GPUand will be computed at each location across channel if input is 4D. 24 | } 25 | 26 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.BatchNorm.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.BatchNorm} 4 | \alias{mx.symbol.BatchNorm} 5 | \title{Apply batch normalization to input.} 6 | \usage{ 7 | mx.symbol.BatchNorm(...) 8 | } 9 | \arguments{ 10 | \item{data}{Symbol 11 | Input data to batch normalization} 12 | 13 | \item{eps}{float, optional, default=0.001 14 | Epsilon to prevent div 0} 15 | 16 | \item{momentum}{float, optional, default=0.9 17 | Momentum for moving average} 18 | 19 | \item{fix.gamma}{boolean, optional, default=True 20 | Fix gamma while training} 21 | 22 | \item{use.global.stats}{boolean, optional, default=False 23 | Whether use global moving statistics instead of local batch-norm. This will force change batch-norm into a scale shift operator.} 24 | 25 | \item{name}{string, optional 26 | Name of the resulting symbol.} 27 | } 28 | \value{ 29 | out The result mx.symbol 30 | } 31 | \description{ 32 | Apply batch normalization to input. 33 | } 34 | 35 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.BlockGrad.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.BlockGrad} 4 | \alias{mx.symbol.BlockGrad} 5 | \title{Get output from a symbol and pass 0 gradient back} 6 | \usage{ 7 | mx.symbol.BlockGrad(...) 8 | } 9 | \arguments{ 10 | \item{data}{Symbol 11 | Input data.} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Get output from a symbol and pass 0 gradient back 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.Cast.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.Cast} 4 | \alias{mx.symbol.Cast} 5 | \title{Cast array to a different data type.} 6 | \usage{ 7 | mx.symbol.Cast(...) 8 | } 9 | \arguments{ 10 | \item{data}{Symbol 11 | Input data to cast function.} 12 | 13 | \item{dtype}{{'float16', 'float32', 'float64', 'int32', 'uint8'}, required 14 | Target data type.} 15 | 16 | \item{name}{string, optional 17 | Name of the resulting symbol.} 18 | } 19 | \value{ 20 | out The result mx.symbol 21 | } 22 | \description{ 23 | Cast array to a different data type. 24 | } 25 | 26 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.Concat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/symbol.R 3 | \name{mx.symbol.Concat} 4 | \alias{mx.symbol.Concat} 5 | \title{Perform an feature concat on channel dim (dim 1) over all the inputs.} 6 | \usage{ 7 | mx.symbol.Concat(data, num.args, dim = NULL, name = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{list, required 11 | List of tensors to concatenate} 12 | 13 | \item{num.args}{int, required 14 | Number of inputs to be concated.} 15 | 16 | \item{dim}{int, optional, default='1' 17 | the dimension to be concated.} 18 | 19 | \item{name}{string, optional 20 | Name of the resulting symbol.} 21 | } 22 | \value{ 23 | out The result mx.symbol 24 | } 25 | \description{ 26 | Perform an feature concat on channel dim (dim 1) over all the inputs. 27 | } 28 | 29 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.Dropout.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.Dropout} 4 | \alias{mx.symbol.Dropout} 5 | \title{Apply dropout to input} 6 | \usage{ 7 | mx.symbol.Dropout(...) 8 | } 9 | \arguments{ 10 | \item{data}{Symbol 11 | Input data to dropout.} 12 | 13 | \item{p}{float, optional, default=0.5 14 | Fraction of the input that gets dropped out at training time} 15 | 16 | \item{name}{string, optional 17 | Name of the resulting symbol.} 18 | } 19 | \value{ 20 | out The result mx.symbol 21 | } 22 | \description{ 23 | Apply dropout to input 24 | } 25 | 26 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.ElementWiseSum.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.ElementWiseSum} 4 | \alias{mx.symbol.ElementWiseSum} 5 | \title{Perform an elementwise sum over all the inputs.} 6 | \usage{ 7 | mx.symbol.ElementWiseSum(...) 8 | } 9 | \arguments{ 10 | \item{num.args}{int, required 11 | Number of inputs to be summed.} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Perform an elementwise sum over all the inputs. 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.Flatten.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.Flatten} 4 | \alias{mx.symbol.Flatten} 5 | \title{Flatten input} 6 | \usage{ 7 | mx.symbol.Flatten(...) 8 | } 9 | \arguments{ 10 | \item{data}{Symbol 11 | Input data to flatten.} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Flatten input 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.FullyConnected.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.FullyConnected} 4 | \alias{mx.symbol.FullyConnected} 5 | \title{Apply matrix multiplication to input then add a bias.} 6 | \usage{ 7 | mx.symbol.FullyConnected(...) 8 | } 9 | \arguments{ 10 | \item{data}{Symbol 11 | Input data to the FullyConnectedOp.} 12 | 13 | \item{weight}{Symbol 14 | Weight matrix.} 15 | 16 | \item{bias}{Symbol 17 | Bias parameter.} 18 | 19 | \item{num.hidden}{int, required 20 | Number of hidden nodes of the output.} 21 | 22 | \item{no.bias}{boolean, optional, default=False 23 | Whether to disable bias parameter.} 24 | 25 | \item{name}{string, optional 26 | Name of the resulting symbol.} 27 | } 28 | \value{ 29 | out The result mx.symbol 30 | } 31 | \description{ 32 | Apply matrix multiplication to input then add a bias. 33 | } 34 | 35 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.Group.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/symbol.R 3 | \name{mx.symbol.Group} 4 | \alias{mx.symbol.Group} 5 | \title{Create a symbol that groups symbols together.} 6 | \usage{ 7 | mx.symbol.Group(...) 8 | } 9 | \arguments{ 10 | \item{kwarg}{Variable length of symbols or list of symbol.} 11 | } 12 | \value{ 13 | The result symbol 14 | } 15 | \description{ 16 | Create a symbol that groups symbols together. 17 | } 18 | 19 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.IdentityAttachKLSparseReg.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.IdentityAttachKLSparseReg} 4 | \alias{mx.symbol.IdentityAttachKLSparseReg} 5 | \title{Apply a sparse regularization to the output a sigmoid activation function.} 6 | \usage{ 7 | mx.symbol.IdentityAttachKLSparseReg(...) 8 | } 9 | \arguments{ 10 | \item{data}{Symbol 11 | Input data.} 12 | 13 | \item{sparseness.target}{float, optional, default=0.1 14 | The sparseness target} 15 | 16 | \item{penalty}{float, optional, default=0.001 17 | The tradeoff parameter for the sparseness penalty} 18 | 19 | \item{momentum}{float, optional, default=0.9 20 | The momentum for running average} 21 | 22 | \item{name}{string, optional 23 | Name of the resulting symbol.} 24 | } 25 | \value{ 26 | out The result mx.symbol 27 | } 28 | \description{ 29 | Apply a sparse regularization to the output a sigmoid activation function. 30 | } 31 | 32 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.LRN.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.LRN} 4 | \alias{mx.symbol.LRN} 5 | \title{Apply convolution to input then add a bias.} 6 | \usage{ 7 | mx.symbol.LRN(...) 8 | } 9 | \arguments{ 10 | \item{data}{Symbol 11 | Input data to the ConvolutionOp.} 12 | 13 | \item{alpha}{float, optional, default=0.0001 14 | value of the alpha variance scaling parameter in the normalization formula} 15 | 16 | \item{beta}{float, optional, default=0.75 17 | value of the beta power parameter in the normalization formula} 18 | 19 | \item{knorm}{float, optional, default=2 20 | value of the k parameter in normalization formula} 21 | 22 | \item{nsize}{int (non-negative), required 23 | normalization window width in elements.} 24 | 25 | \item{name}{string, optional 26 | Name of the resulting symbol.} 27 | } 28 | \value{ 29 | out The result mx.symbol 30 | } 31 | \description{ 32 | Apply convolution to input then add a bias. 33 | } 34 | 35 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.LinearRegressionOutput.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.LinearRegressionOutput} 4 | \alias{mx.symbol.LinearRegressionOutput} 5 | \title{Use linear regression for final output, this is used on final output of a net.} 6 | \usage{ 7 | mx.symbol.LinearRegressionOutput(...) 8 | } 9 | \arguments{ 10 | \item{data}{Symbol 11 | Input data to function.} 12 | 13 | \item{label}{Symbol 14 | Input label to function.} 15 | 16 | \item{grad.scale}{float, optional, default=1 17 | Scale the gradient by a float factor} 18 | 19 | \item{name}{string, optional 20 | Name of the resulting symbol.} 21 | } 22 | \value{ 23 | out The result mx.symbol 24 | } 25 | \description{ 26 | Use linear regression for final output, this is used on final output of a net. 27 | } 28 | 29 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.MAERegressionOutput.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.MAERegressionOutput} 4 | \alias{mx.symbol.MAERegressionOutput} 5 | \title{Use mean absolute error regression for final output, this is used on final output of a net.} 6 | \usage{ 7 | mx.symbol.MAERegressionOutput(...) 8 | } 9 | \arguments{ 10 | \item{data}{Symbol 11 | Input data to function.} 12 | 13 | \item{label}{Symbol 14 | Input label to function.} 15 | 16 | \item{grad.scale}{float, optional, default=1 17 | Scale the gradient by a float factor} 18 | 19 | \item{name}{string, optional 20 | Name of the resulting symbol.} 21 | } 22 | \value{ 23 | out The result mx.symbol 24 | } 25 | \description{ 26 | Use mean absolute error regression for final output, this is used on final output of a net. 27 | } 28 | 29 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.SliceChannel.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.SliceChannel} 4 | \alias{mx.symbol.SliceChannel} 5 | \title{Slice input equally along specified axis} 6 | \usage{ 7 | mx.symbol.SliceChannel(...) 8 | } 9 | \arguments{ 10 | \item{num.outputs}{int, required 11 | Number of outputs to be sliced.} 12 | 13 | \item{axis}{int, optional, default='1' 14 | Dimension along which to slice.} 15 | 16 | \item{squeeze.axis}{boolean, optional, default=False 17 | If true AND the sliced dimension becomes 1, squeeze that dimension.} 18 | 19 | \item{name}{string, optional 20 | Name of the resulting symbol.} 21 | } 22 | \value{ 23 | out The result mx.symbol 24 | } 25 | \description{ 26 | Slice input equally along specified axis 27 | } 28 | 29 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.SwapAxis.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.SwapAxis} 4 | \alias{mx.symbol.SwapAxis} 5 | \title{Apply swapaxis to input.} 6 | \usage{ 7 | mx.symbol.SwapAxis(...) 8 | } 9 | \arguments{ 10 | \item{data}{Symbol 11 | Input data to the SwapAxisOp.} 12 | 13 | \item{dim1}{int (non-negative), optional, default=0 14 | the first axis to be swapped.} 15 | 16 | \item{dim2}{int (non-negative), optional, default=0 17 | the second axis to be swapped.} 18 | 19 | \item{name}{string, optional 20 | Name of the resulting symbol.} 21 | } 22 | \value{ 23 | out The result mx.symbol 24 | } 25 | \description{ 26 | Apply swapaxis to input. 27 | } 28 | 29 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.Variable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/symbol.R 3 | \name{mx.symbol.Variable} 4 | \alias{mx.symbol.Variable} 5 | \title{Create a symbolic variable with specified name.} 6 | \arguments{ 7 | \item{name}{string 8 | The name of the result symbol.} 9 | } 10 | \value{ 11 | The result symbol 12 | } 13 | \description{ 14 | Create a symbolic variable with specified name. 15 | } 16 | 17 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.abs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.abs} 4 | \alias{mx.symbol.abs} 5 | \title{Take absolute value of the src} 6 | \usage{ 7 | mx.symbol.abs(...) 8 | } 9 | \arguments{ 10 | \item{src}{Symbol 11 | Left symbolic input to the function} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Take absolute value of the src 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.ceil.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.ceil} 4 | \alias{mx.symbol.ceil} 5 | \title{Take ceil value of the src} 6 | \usage{ 7 | mx.symbol.ceil(...) 8 | } 9 | \arguments{ 10 | \item{src}{Symbol 11 | Left symbolic input to the function} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Take ceil value of the src 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.cos.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.cos} 4 | \alias{mx.symbol.cos} 5 | \title{Take cos of the src} 6 | \usage{ 7 | mx.symbol.cos(...) 8 | } 9 | \arguments{ 10 | \item{src}{Symbol 11 | Left symbolic input to the function} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Take cos of the src 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.exp.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.exp} 4 | \alias{mx.symbol.exp} 5 | \title{Take exp of the src} 6 | \usage{ 7 | mx.symbol.exp(...) 8 | } 9 | \arguments{ 10 | \item{src}{Symbol 11 | Left symbolic input to the function} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Take exp of the src 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.floor.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.floor} 4 | \alias{mx.symbol.floor} 5 | \title{Take floor value of the src} 6 | \usage{ 7 | mx.symbol.floor(...) 8 | } 9 | \arguments{ 10 | \item{src}{Symbol 11 | Left symbolic input to the function} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Take floor value of the src 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.infer.shape.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/symbol.R 3 | \name{mx.symbol.infer.shape} 4 | \alias{mx.symbol.infer.shape} 5 | \title{Inference the shape of arguments, outputs, and auxiliary states.} 6 | \usage{ 7 | mx.symbol.infer.shape(symbol, ...) 8 | } 9 | \arguments{ 10 | \item{symbol}{The \code{mx.symbol} object} 11 | } 12 | \description{ 13 | Inference the shape of arguments, outputs, and auxiliary states. 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.load.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/symbol.R 3 | \name{mx.symbol.load} 4 | \alias{mx.symbol.load} 5 | \title{Load an mx.symbol object} 6 | \usage{ 7 | mx.symbol.load(filename) 8 | } 9 | \arguments{ 10 | \item{filename}{the filename (including the path)} 11 | } 12 | \description{ 13 | Load an mx.symbol object 14 | } 15 | \examples{ 16 | data = mx.symbol.Variable('data') 17 | mx.symbol.save(data, 'temp.symbol') 18 | data2 = mx.symbol.load('temp.symbol') 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.load.json.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/symbol.R 3 | \name{mx.symbol.load.json} 4 | \alias{mx.symbol.load.json} 5 | \title{Load an mx.symbol object from a json string} 6 | \arguments{ 7 | \item{str}{the json str represent a mx.symbol} 8 | } 9 | \description{ 10 | Load an mx.symbol object from a json string 11 | } 12 | 13 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.log.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.log} 4 | \alias{mx.symbol.log} 5 | \title{Take log of the src} 6 | \usage{ 7 | mx.symbol.log(...) 8 | } 9 | \arguments{ 10 | \item{src}{Symbol 11 | Left symbolic input to the function} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Take log of the src 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.round.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.round} 4 | \alias{mx.symbol.round} 5 | \title{Take round value of the src} 6 | \usage{ 7 | mx.symbol.round(...) 8 | } 9 | \arguments{ 10 | \item{src}{Symbol 11 | Left symbolic input to the function} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Take round value of the src 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.rsqrt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.rsqrt} 4 | \alias{mx.symbol.rsqrt} 5 | \title{Take rsqrt of the src} 6 | \usage{ 7 | mx.symbol.rsqrt(...) 8 | } 9 | \arguments{ 10 | \item{src}{Symbol 11 | Left symbolic input to the function} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Take rsqrt of the src 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.save.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/symbol.R 3 | \name{mx.symbol.save} 4 | \alias{mx.symbol.save} 5 | \title{Save an mx.symbol object} 6 | \usage{ 7 | mx.symbol.save(symbol, filename) 8 | } 9 | \arguments{ 10 | \item{symbol}{the \code{mx.symbol} object} 11 | 12 | \item{filename}{the filename (including the path)} 13 | } 14 | \description{ 15 | Save an mx.symbol object 16 | } 17 | \examples{ 18 | data = mx.symbol.Variable('data') 19 | mx.symbol.save(data, 'temp.symbol') 20 | data2 = mx.symbol.load('temp.symbol') 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.sign.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.sign} 4 | \alias{mx.symbol.sign} 5 | \title{Take sign value of the src} 6 | \usage{ 7 | mx.symbol.sign(...) 8 | } 9 | \arguments{ 10 | \item{src}{Symbol 11 | Left symbolic input to the function} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Take sign value of the src 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.sin.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.sin} 4 | \alias{mx.symbol.sin} 5 | \title{Take sin of the src} 6 | \usage{ 7 | mx.symbol.sin(...) 8 | } 9 | \arguments{ 10 | \item{src}{Symbol 11 | Left symbolic input to the function} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Take sin of the src 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.sqrt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.sqrt} 4 | \alias{mx.symbol.sqrt} 5 | \title{Take sqrt of the src} 6 | \usage{ 7 | mx.symbol.sqrt(...) 8 | } 9 | \arguments{ 10 | \item{src}{Symbol 11 | Left symbolic input to the function} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Take sqrt of the src 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mx.symbol.square.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mxnet_generated.R 3 | \name{mx.symbol.square} 4 | \alias{mx.symbol.square} 5 | \title{Take square of the src} 6 | \usage{ 7 | mx.symbol.square(...) 8 | } 9 | \arguments{ 10 | \item{src}{Symbol 11 | Left symbolic input to the function} 12 | 13 | \item{name}{string, optional 14 | Name of the resulting symbol.} 15 | } 16 | \value{ 17 | out The result mx.symbol 18 | } 19 | \description{ 20 | Take square of the src 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R-package/man/mxnet.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/zzz.R 3 | \docType{package} 4 | \name{mxnet} 5 | \alias{mxnet} 6 | \alias{mxnet-package} 7 | \title{MXNet: Flexible and Efficient GPU computing and Deep Learning.} 8 | \description{ 9 | MXNet is a flexible and efficient GPU computing and deep learning framework. 10 | } 11 | \details{ 12 | It enables you to write seamless tensor/matrix computation with multiple GPUs in R. 13 | 14 | It also enables you construct and customize the state-of-art deep learning models in R, 15 | and apply them to tasks such as image classification and data science challenges. 16 | } 17 | 18 | -------------------------------------------------------------------------------- /R-package/man/mxnet.export.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/util.R 3 | \name{mxnet.export} 4 | \alias{mxnet.export} 5 | \title{Internal function to generate mxnet_generated.R 6 | Users do not need to call this function.} 7 | \usage{ 8 | mxnet.export(path) 9 | } 10 | \arguments{ 11 | \item{path}{The path to the root of the package.} 12 | } 13 | \description{ 14 | Internal function to generate mxnet_generated.R 15 | Users do not need to call this function. 16 | } 17 | 18 | -------------------------------------------------------------------------------- /R-package/man/outputs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/symbol.R 3 | \name{outputs} 4 | \alias{outputs} 5 | \title{Get the outputs of a symbol.} 6 | \usage{ 7 | outputs(x) 8 | } 9 | \arguments{ 10 | \item{x}{The input symbol} 11 | } 12 | \description{ 13 | Get the outputs of a symbol. 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/man/print.MXNDArray.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ndarray.R 3 | \name{print.MXNDArray} 4 | \alias{print.MXNDArray} 5 | \title{print operator overload of mx.ndarray} 6 | \usage{ 7 | \method{print}{MXNDArray}(nd) 8 | } 9 | \arguments{ 10 | \item{nd}{The mx.ndarray} 11 | } 12 | \description{ 13 | print operator overload of mx.ndarray 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R-package/src/Makevars: -------------------------------------------------------------------------------- 1 | 2 | PKG_CPPFLAGS = -I../inst/include 3 | PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) 4 | -------------------------------------------------------------------------------- /R-package/src/Makevars.win: -------------------------------------------------------------------------------- 1 | 2 | PKG_CPPFLAGS = -I../inst/include 3 | PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) -L../inst/libs/x64/ -llibmxnet 4 | -------------------------------------------------------------------------------- /R-package/tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(mxnet) 3 | 4 | test_check("mxnet") 5 | -------------------------------------------------------------------------------- /R-package/tests/testthat/test_symbol.R: -------------------------------------------------------------------------------- 1 | require(mxnet) 2 | 3 | context("symbol") 4 | 5 | test_that("basic symbol operation", { 6 | data = mx.symbol.Variable('data') 7 | net1 = mx.symbol.FullyConnected(data=data, name='fc1', num_hidden=10) 8 | net1 = mx.symbol.FullyConnected(data=net1, name='fc2', num_hidden=100) 9 | 10 | expect_equal(arguments(net1), c('data', 'fc1_weight', 'fc1_bias', 'fc2_weight', 'fc2_bias')) 11 | 12 | net2 = mx.symbol.FullyConnected(name='fc3', num_hidden=10) 13 | net2 = mx.symbol.Activation(data=net2, act_type='relu') 14 | net2 = mx.symbol.FullyConnected(data=net2, name='fc4', num_hidden=20) 15 | 16 | composed = mx.apply(net2, fc3_data=net1, name='composed') 17 | 18 | expect_equal(arguments(composed), c('data', 'fc1_weight', 'fc1_bias', 'fc2_weight', 'fc2_bias', 'fc3_weight', 'fc3_bias', 'fc4_weight', 'fc4_bias')) 19 | }) 20 | 21 | 22 | -------------------------------------------------------------------------------- /amalgamation/.gitignore: -------------------------------------------------------------------------------- 1 | *-all.cc 2 | -------------------------------------------------------------------------------- /amalgamation/jni/org/dmlc/mxnet/MxnetException.java: -------------------------------------------------------------------------------- 1 | package org.dmlc.mxnet; 2 | 3 | public class MxnetException extends Exception { 4 | public MxnetException(){} 5 | public MxnetException(String txt) { 6 | super(txt); 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /docker/cpu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | MAINTAINER Mu Li 3 | 4 | # install the core library 5 | RUN apt-get update && apt-get install -y build-essential git libopenblas-dev libopencv-dev 6 | RUN git clone --recursive https://github.com/dmlc/mxnet/ && cd mxnet && \ 7 | cp make/config.mk . && \ 8 | echo "USE_BLAS=openblas" >>config.mk && \ 9 | make -j$(nproc) 10 | 11 | # python pakcage 12 | RUN apt-get install -y python-numpy wget unzip 13 | ENV PYTHONPATH /mxnet/python 14 | -------------------------------------------------------------------------------- /docker/cuda/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nvidia/cuda:7.5-cudnn4-devel 2 | MAINTAINER Mu Li 3 | 4 | # install the core library 5 | RUN apt-get update && apt-get install -y build-essential git libopenblas-dev libopencv-dev 6 | RUN git clone --recursive https://github.com/dmlc/mxnet/ && cd mxnet && \ 7 | cp make/config.mk . && \ 8 | echo "USE_CUDA=1" >>config.mk && \ 9 | echo "USE_CUDA_PATH=/usr/local/cuda" >>config.mk && \ 10 | echo "USE_CUDNN=1" >>config.mk && \ 11 | echo "USE_BLAS=openblas" >>config.mk && \ 12 | make -j$(nproc) ADD_LDFLAGS=-L/usr/local/cuda/lib64/stubs 13 | ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:$LD_LIBRARY_PATH 14 | 15 | # python pakcage 16 | RUN apt-get install -y python-numpy wget unzip 17 | ENV PYTHONPATH /mxnet/python 18 | -------------------------------------------------------------------------------- /docs/.dockerignore: -------------------------------------------------------------------------------- 1 | Dockerfile 2 | _build 3 | 4 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _build/* 2 | *.pyc 3 | doxygen 4 | -------------------------------------------------------------------------------- /docs/_static/js/auto_module_index.js: -------------------------------------------------------------------------------- 1 | function auto_index(module) { 2 | $(document).ready(function () { 3 | // find all classes or functions 4 | var div_query = "div[class='section'][id='" + module + "']"; 5 | var class_query = div_query + " dl[class='class'] > dt"; 6 | var func_query = div_query + " dl[class='function'] > dt"; 7 | var targets = $(class_query + ',' + func_query); 8 | 9 | var li_node = $("div.sphinxsidebarwrapper li a[href='#" + module + "']").parent(); 10 | var html = "
    "; 11 | 12 | for (var i = 0; i < targets.length; ++i) { 13 | var id = $(targets[i]).attr('id'); 14 | // remove 'mxnet.' prefix to make menus shorter 15 | var id_simple = id.replace(/^mxnet\./, ''); 16 | html += "
  • " + id_simple + "
  • "; 19 | } 20 | 21 | html += "
"; 22 | li_node.append(html); 23 | }); 24 | } -------------------------------------------------------------------------------- /docs/_static/js/search.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | var searchForm = $("#search-input-wrap").children("form").first(); 3 | searchForm.append('
'); 4 | searchForm.children("div").first().addClass("searchBox"); 5 | }); -------------------------------------------------------------------------------- /docs/_static/mxnet-theme/footer.html: -------------------------------------------------------------------------------- 1 |
2 | 5 |
6 | -------------------------------------------------------------------------------- /docs/_static/mxnet-theme/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | -------------------------------------------------------------------------------- /docs/_static/selectlang.js: -------------------------------------------------------------------------------- 1 | function changeLanguage(langSelect, langSelectLabel, rootpath){ 2 | langSelect.change(function() { 3 | var lang = langSelect.val(); 4 | if(lang == 'zh'){ 5 | location.href = rootpath + 'zh/index.html'; 6 | } else { 7 | location.href = rootpath + 'index.html'; 8 | } 9 | }); 10 | } 11 | 12 | $(document).ready(function () { 13 | var langSelect = $("#lang-select"); 14 | var langSelectLabel = $("#lang-select-label > span"); 15 | currHref = location.href; 16 | 17 | if(/\/zh\//.test(currHref)){ 18 | langSelect.val("zh"); 19 | } else { 20 | langSelect.val("en"); 21 | } 22 | langSelectLabel.text($("option:selected").text()); 23 | 24 | changeLanguage(langSelect, langSelectLabel, getRootPath()); 25 | }) -------------------------------------------------------------------------------- /docs/api/c++/index.md: -------------------------------------------------------------------------------- 1 | # MXNet - C++ API 2 | 3 | For namespaces, classes, and code files for the MXNet C++ package, see the following: 4 | 5 | * [Namespaces](http://mxnet.io/doxygen/namespaces.html) 6 | * [Classes](http://mxnet.io/doxygen/annotated.html) 7 | * [Code Files](http://mxnet.io/doxygen/files.html) 8 | * [MXNet CPP Package](https://github.com/dmlc/MXNet.cpp) 9 | -------------------------------------------------------------------------------- /docs/api/julia/index.md: -------------------------------------------------------------------------------- 1 | MXNet - Julia API 2 | ================= 3 | MXNet supports Julia programming language. The MXNet Julia package brings flexible and efficient GPU 4 | computing and state-of-art deep learning to Julia. 5 | 6 | - It enables you to write seamless tensor/matrix computation with multiple GPUs in Julia. 7 | - It also enables you construct and customize the state-of-art deep learning models in Julia, 8 | and apply them to tasks such as image classification and data science challenges. 9 | 10 | 11 |   12 | 13 | Julia documents are available at [http://dmlc.ml/MXNet.jl/latest/](http://dmlc.ml/MXNet.jl/latest/). 14 | -------------------------------------------------------------------------------- /docs/api/r/Makefile: -------------------------------------------------------------------------------- 1 | # This is the makefile for compiling Rmarkdown files into the md file with results. 2 | PKGROOT=../../R-package 3 | 4 | # ADD The Markdown to be built here, with suffix md 5 | classifyRealImageWithPretrainedModel.md: 6 | mnistCompetition.md: 7 | ndarrayAndSymbolTutorial.md: 8 | fiveMinutesNeuralNetwork.md: 9 | 10 | # General Rules for build rmarkdowns, need knitr 11 | %.md: $(PKGROOT)/vignettes/%.Rmd 12 | rm -rf "../../web-data/mxnet/knitr/$(basename $@)-"*; 13 | Rscript -e \ 14 | "require(knitr);"\ 15 | "knitr::opts_knit\$$set(root.dir=\".\");"\ 16 | "knitr::opts_chunk\$$set(fig.path=\"../../web-data/mxnet/knitr/$(basename $@)-\");"\ 17 | "knitr::knit(\"$+\")" 18 | -------------------------------------------------------------------------------- /docs/architecture/read_code.md: -------------------------------------------------------------------------------- 1 | # Read MXNet Code 2 | - All of the module interfaces are listed in [include](../../include). The 3 | interfaces are heavily documented. 4 | - Read the 5 | [Doxygen Version](http://mxnet.io/api/c++/index.html) of the 6 | document. 7 | - Each module depends on other modules as defined in the header files in 8 | [include](../../include). 9 | - Module implementation is in the [src](../../src) folder. 10 | - Source code sees only the file within its folder, 11 | [src/common](../../src/common) and [include](../../include). 12 | 13 | Most modules are mostly self-contained, with interface dependency on the engine. 14 | You're free to pick the one you are interested in, and read that part. 15 | 16 | ## Next Steps 17 | 18 | * [Develop and Hack MXNet](http://mxnet.io/how_to/develop_and_hack.html) 19 | -------------------------------------------------------------------------------- /docs/build-notebooks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # scripts to add https://github.com/dmlc/mxnet-notebooksa into docs/ 4 | 5 | notebook2markdown() { 6 | src=$1 7 | dst=$2 8 | for f in $src/*.ipynb; do 9 | jupyter nbconvert $f --to markdown 10 | bname=$(basename "$f" .ipynb) 11 | echo -e "\n\n## Next Steps\n* [MXNet Tutorials Index](http://mxnet.io/tutorials/index.html)\n* [MXNet Notebooks on GitHub](https://github.com/dmlc/mxnet-notebooks)" >>${src}/${bname}.md 12 | mv -f ${src}/${bname}.md ${dst} 13 | if [ -e ${src}/${bname}_files ]; then 14 | mv -f ${src}/${bname}_files ${dst}/ 15 | fi 16 | done 17 | } 18 | 19 | rm -rf mxnet-notebooks 20 | git clone https://github.com/dmlc/mxnet-notebooks 21 | notebook2markdown mxnet-notebooks/python/basic tutorials/python/ 22 | notebook2markdown mxnet-notebooks/python/how_to how_to/ 23 | notebook2markdown mxnet-notebooks/python/tutorials tutorials/python/ 24 | rm -rf mxnet-notebooks 25 | -------------------------------------------------------------------------------- /docs/build-preview.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script to build the HTML docs and serve them. 4 | # Run within docker container for best results. 5 | 6 | echo "Building MXNet documentation..." 7 | make clean 8 | make html 9 | echo "Done building MXNet documentation..." 10 | 11 | echo "Serving MXNet docs on port 8008..." 12 | cd _build/html 13 | python -m SimpleHTTPServer 8008 14 | 15 | -------------------------------------------------------------------------------- /docs/community/index.md: -------------------------------------------------------------------------------- 1 | # MXNet Community 2 | ## Questions about Using MXNet 3 | If you are not sure of how to use MXNet for something, or have questions about applying it to a particular kind of problem, please post a question at [Stackoverflow](http://stackoverflow.com/) with tag - ```mxnet```. You can view stackoverflow questions about mxnet [here](http://stackoverflow.com/questions/tagged/mxnet). 4 | 5 | ## Issue Tracker 6 | We track bugs and new feature requests in the MXNet Github repo in the issues folder: [mxnet/issues](https://github.com/dmlc/mxnet/issues). 7 | 8 | ## Contributors 9 | MXNet has been developed and is used by a group of active community members. Contribute to improve it! For more information, see [contributions](http://mxnet.io/community/contribute.html). 10 | 11 | ## Roadmap 12 | 13 | MXNet is evolving fast. To see what's next and what we are working on internally, go to the [MXNet Roadmap](https://github.com/dmlc/mxnet/labels/Roadmap). -------------------------------------------------------------------------------- /docs/how_to/develop_and_hack.md: -------------------------------------------------------------------------------- 1 | # Develop and Hack MXNet 2 | - [Create new operators](new_op.md) 3 | - [Use Torch from MXNet](torch.md) 4 | - [Set environment variables of MXNet](env_var.md) 5 | 6 | # Other Resources 7 | - [MXNet System Architecture Overview](http://mxnet.io/architecture/overview.html) 8 | - [Contributor Guidelines](http://mxnet.io/community/contribute.html) -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | Contents 2 | -------- 3 | These are used to generate the index used in search. 4 | 5 | - [Python Documents](api/python/index.md) 6 | - [R Documents](api/r/index.md) 7 | - [Julia Documents](api/julia/index.md) 8 | - [Julia Documents](api/c++/index.md) 9 | - [Scala Documents](api/scala/index.md) 10 | - [Howto Documents](how_to/index.md) 11 | - [Get Started Documents](get_started/index.md) 12 | - [System Documents](architecture/index.md) 13 | - [Tutorials](tutorials/index.md) 14 | 15 | # Chinese translation of docs 16 | - [Chinese translation of docs](index_zh.md) 17 | -------------------------------------------------------------------------------- /docs/packages/c++/index.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/c++/index.html' 3 | -------------------------------------------------------------------------------- /docs/packages/julia/index.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/julia/index.html' 3 | -------------------------------------------------------------------------------- /docs/packages/python/index.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/python/index.html' 3 | -------------------------------------------------------------------------------- /docs/packages/python/io.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/python/io.html' 3 | -------------------------------------------------------------------------------- /docs/packages/python/kvstore.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/python/kvstore.html' 3 | -------------------------------------------------------------------------------- /docs/packages/python/model.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/python/model.html' 3 | -------------------------------------------------------------------------------- /docs/packages/python/module.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/python/module.html' 3 | -------------------------------------------------------------------------------- /docs/packages/python/ndarray.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/python/ndarray.html' 3 | -------------------------------------------------------------------------------- /docs/packages/python/symbol.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/python/symbol.html' 3 | -------------------------------------------------------------------------------- /docs/packages/python/symbol_in_pictures.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/python/symbol_in_pictures.html' 3 | -------------------------------------------------------------------------------- /docs/packages/python/tutorial.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/python/tutorial.html' 3 | -------------------------------------------------------------------------------- /docs/packages/r/CallbackFunctionTutorial.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/r/CallbackFunctionTutorial.html' 3 | -------------------------------------------------------------------------------- /docs/packages/r/CharRnnModel.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/r/CharRnnModel.html' 3 | -------------------------------------------------------------------------------- /docs/packages/r/classifyRealImageWithPretrainedModel.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/r/classifyRealImageWithPretrainedModel.html' 3 | -------------------------------------------------------------------------------- /docs/packages/r/fiveMinutesNeuralNetwork.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/r/fiveMinutesNeuralNetwork.html' 3 | -------------------------------------------------------------------------------- /docs/packages/r/index.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/r/index.html' 3 | -------------------------------------------------------------------------------- /docs/packages/r/mnistCompetition.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/r/mnistCompetition.html' 3 | -------------------------------------------------------------------------------- /docs/packages/r/ndarrayAndSymbolTutorial.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/r/ndarrayAndSymbolTutorial.html' 3 | -------------------------------------------------------------------------------- /docs/packages/scala/index.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/api/scala/index.html' 3 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | breathe 2 | -------------------------------------------------------------------------------- /docs/system/engine.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/architecture/note_engine.html' 3 | -------------------------------------------------------------------------------- /docs/system/index.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/architecture/index.html' -------------------------------------------------------------------------------- /docs/system/multi_node.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/architecture/overview.html' 3 | -------------------------------------------------------------------------------- /docs/system/note_data_loading.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/architecture/note_data_loading.html' 3 | -------------------------------------------------------------------------------- /docs/system/note_engine.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/architecture/note_engine.html' 3 | -------------------------------------------------------------------------------- /docs/system/note_memory.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/architecture/note_memory.html' 3 | -------------------------------------------------------------------------------- /docs/system/operator.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/architecture/overview.html#operators-in-mxnet' 3 | -------------------------------------------------------------------------------- /docs/system/operator_util.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/architecture/overview.html#simpleop-the-unified-operator-api' 3 | -------------------------------------------------------------------------------- /docs/system/program_model.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/architecture/program_model.html' 3 | -------------------------------------------------------------------------------- /docs/system/rnn_interface.rst: -------------------------------------------------------------------------------- 1 | .. meta:: 2 | :http-equiv=refresh: 0;URL='http://mxnet.io/architecture/rnn_interface.html' 3 | -------------------------------------------------------------------------------- /docs/tutorials/general_ml/recommendation_systems.md: -------------------------------------------------------------------------------- 1 | # Recommendation Systems 2 | 3 | Get the source code for an example of a recommendation system based on MXNet on [GitHub](https://github.com/dmlc/mxnet-notebooks/tree/master/python/recommendation_systems). 4 | 5 | ## Next Steps 6 | * [MXNet tutorials index](http://mxnet.io/tutorials/index.html) -------------------------------------------------------------------------------- /docs/tutorials/nlp/rnn.md: -------------------------------------------------------------------------------- 1 | # Recurrent Neural Networks 2 | This folder contains RNN examples using a low-level symbol interface. You can get the source code for this example on [GitHub](https://github.com/dmlc/mxnet/tree/master/example/rnn). 3 | 4 | ## Python 5 | 6 | - [lstm.py](lstm.py). Functions for building an LSTM Network 7 | - [gru.py](gru.py). Functions for building a GRU Network 8 | - [lstm_bucketing.py](lstm_bucketing.py). A PennTreeBank language model using LSTM 9 | - [gru_bucketing.py](gru_bucketing.py). A PennTreeBank language model using GRU 10 | - [char-rnn.ipynb](char-rnn.ipynb). A notebook that demonstrates how to train a character LSTM by using ```lstm.py``` 11 | 12 | 13 | Performance Note: 14 | 15 | Using more ```MXNET_GPU_WORKER_NTHREADS``` may lead to better performance. For information on setting ```MXNET_GPU_WORKER_NTHREADS```, refer to [Environment Variables](http://mxnet.io/how_to/env_var.html). 16 | 17 | ## Next Steps 18 | * [MXNet tutorials index](http://mxnet.io/tutorials/index.html) 19 | -------------------------------------------------------------------------------- /docs/tutorials/unsupervised_learning/auto_encoders.md: -------------------------------------------------------------------------------- 1 | # Autoencoders 2 | Get the source code for an example of autoencoders running on MXNet on GitHub in the [autoencoder](https://github.com/dmlc/mxnet/tree/master/example/autoencoder) folder. 3 | 4 | ## Next Steps 5 | * [MXNet tutorials index](http://mxnet.io/tutorials/index.html) -------------------------------------------------------------------------------- /docs/tutorials/unsupervised_learning/gan.md: -------------------------------------------------------------------------------- 1 | # Generative Adversarial Network 2 | Get the source code for an example of a generative adversarial network (GAN) running on MXNet on GitHub in the [gan](https://github.com/dmlc/mxnet/tree/master/example/gan) folder. 3 | 4 | ## Next Steps 5 | * [MXNet tutorials index](http://mxnet.io/tutorials/index.html) -------------------------------------------------------------------------------- /docs/zh/api/python/index.md: -------------------------------------------------------------------------------- 1 | MXNet Python Package 2 | ==================== 3 | 4 | 这个页面包含 python 程序包中所有相关的文档. 5 | 为了安装 python 程序包, 请 checkout [Build and Installation Instruction](../../how_to/build.md). 6 | 7 | 这里有关于 mxnet 的三种文档. 8 | 9 | * [Tutorials](#tutorials) 介绍一个特定的关于 mxnet 的用例. 10 | * [Code Examples](../../../example) 示例代码. 11 | * [Python API Documents](#python-api-documents) 关于指定模块的文档, 同时也包含所有 API 的参考文档. 12 | 13 | Tutorials 14 | --------- 15 | * [Python Overview Tutorial](tutorial.md) 16 | * [Symbolic Configuration and Execution in Pictures](symbol_in_pictures.md) 17 | * [How to Create New Operations (Layers)](../../how_to/new_op.md) 18 | 19 | Python API Documents 20 | -------------------- 21 | * [High Level Model Training Related API](model.md) 22 | * [The Module API](module.md) 23 | * [NDArray API](ndarray.md) 24 | * [Symbolic API](symbol.md) 25 | * [KVStore API](kvstore.md) 26 | * [Data Loading API](io.md) 27 | -------------------------------------------------------------------------------- /docs/zh/index.md: -------------------------------------------------------------------------------- 1 | # MXNet 中文文档 2 | 3 | 我们希望能将MXNet文档翻译成中文。但工作量很大,希望大家能一起贡献。 4 | 5 | - [MXNet简介](./overview.md) 6 | - [MXNet的内存优化](./note_memory.md) 7 | -------------------------------------------------------------------------------- /example/adversary/README.md: -------------------------------------------------------------------------------- 1 | # Adversarial examples 2 | 3 | This demonstrates the concept of "adversarial examples" from [1] showing how to fool a well-trained CNN. 4 | The surprising idea is that one can easily generate examples which the CNN will consistently 5 | make the wrong prediction for that a human can easily tell are correct. 6 | 7 | [1] Goodfellow, Ian J., Jonathon Shlens, and Christian Szegedy. "Explaining and harnessing adversarial examples." [arXiv preprint arXiv:1412.6572 (2014)](https://arxiv.org/abs/1412.6572) 8 | -------------------------------------------------------------------------------- /example/autoencoder/data.py: -------------------------------------------------------------------------------- 1 | import os 2 | import numpy as np 3 | from sklearn.datasets import fetch_mldata 4 | 5 | def get_mnist(): 6 | np.random.seed(1234) # set seed for deterministic ordering 7 | data_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) 8 | data_path = os.path.join(data_path, '../../data') 9 | mnist = fetch_mldata('MNIST original', data_home=data_path) 10 | p = np.random.permutation(mnist.data.shape[0]) 11 | X = mnist.data[p].astype(np.float32)*0.02 12 | Y = mnist.target[p] 13 | return X, Y 14 | -------------------------------------------------------------------------------- /example/bayesian-methods/README.md: -------------------------------------------------------------------------------- 1 | Bayesian Methods 2 | ================ 3 | 4 | This folder contains examples related to Bayesian Methods. 5 | 6 | We currently have *Stochastic Gradient Langevin Dynamics (SGLD)* [(Welling and Teh, 2011)](http://www.icml-2011.org/papers/398_icmlpaper.pdf) 7 | and *Bayesian Dark Knowledge (BDK)* [(Balan, Rathod, Murphy and Welling, 2015)](http://papers.nips.cc/paper/5965-bayesian-dark-knowledge). 8 | 9 | **sgld.ipynb** shows how to use MXNet to repeat the toy experiment in the original SGLD paper. 10 | 11 | **bdk.ipynb** shows how to use MXNet to implement the DistilledSGLD algorithm in Bayesian Dark Knowledge. 12 | 13 | **bdk_demo.py** contains scripts (more than the notebook) related to Bayesian Dark Knowledge. Use `python bdk_demo.py -d 1 -l 2 -t 50000` to run classification on MNIST. 14 | -------------------------------------------------------------------------------- /example/bi-lstm-sort/README.md: -------------------------------------------------------------------------------- 1 | This is an example of using bidirection lstm to sort an array. 2 | 3 | Firstly, generate data by: 4 | 5 | cd data 6 | python gen_data.py 7 | 8 | Then, train the model by: 9 | 10 | python lstm_sort.py 11 | 12 | At last, test model by: 13 | 14 | python infer_sort.py 234 189 785 763 231 15 | 16 | and will output sorted seq 17 | 18 | 189 19 | 231 20 | 234 21 | 763 22 | 785 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/fcn-xs/run_fcnxs.sh: -------------------------------------------------------------------------------- 1 | # train fcn-32s model 2 | python -u fcn_xs.py --model=fcn32s --prefix=VGG_FC_ILSVRC_16_layers \ 3 | --epoch=74 --init-type=vgg16 4 | 5 | ## train fcn-16s model 6 | #python -u fcn_xs.py --model=fcn16s --prefix=FCN32s_VGG16 \ 7 | #--epoch=31 --init-type=fcnxs 8 | 9 | # train fcn-8s model 10 | #python -u fcn_xs.py --model=fcn8s --prefix=FCN16s_VGG16 \ 11 | #--epoch=27 --init-type=fcnxs 12 | -------------------------------------------------------------------------------- /example/image-classification/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/image-classification/__init__.py -------------------------------------------------------------------------------- /example/image-classification/common/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/image-classification/common/__init__.py -------------------------------------------------------------------------------- /example/image-classification/common/find_mxnet.py: -------------------------------------------------------------------------------- 1 | import os, sys 2 | os.environ["MXNET_CUDNN_AUTOTUNE_DEFAULT"] = "1" 3 | try: 4 | import mxnet as mx 5 | except ImportError: 6 | curr_path = os.path.abspath(os.path.dirname(__file__)) 7 | sys.path.append(os.path.join(curr_path, "../../../python")) 8 | import mxnet as mx 9 | -------------------------------------------------------------------------------- /example/image-classification/common/util.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import os 3 | 4 | def download_file(url, local_fname=None, force_write=False): 5 | if local_fname is None: 6 | local_fname = url.split('/')[-1] 7 | if not force_write and os.path.exists(local_fname): 8 | return local_fname 9 | 10 | r = requests.get(url, stream=True) 11 | assert r.status_code == 200, "failed to open %s" % url 12 | with open(local_fname, 'wb') as f: 13 | for chunk in r.iter_content(chunk_size=1024): 14 | if chunk: # filter out keep-alive new chunks 15 | f.write(chunk) 16 | return local_fname 17 | -------------------------------------------------------------------------------- /example/image-classification/symbol/README.md: -------------------------------------------------------------------------------- 1 | # Symbol 2 | 3 | This fold contains definition of various networks. To add a new network, please 4 | use the following format. 5 | 6 | ## Python 7 | 8 | - A file implements one network proposed in a paper, with the network name as the 9 | filename. 10 | - Mention the paper and the modifications made if any at the beginning 11 | of the file. 12 | - Indicate how to reproduce the accuracy numbers in the paper if it is not straightforward 13 | - Provide a function `get_symbol()` that return the network 14 | -------------------------------------------------------------------------------- /example/image-classification/symbol/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/image-classification/symbol/__init__.py -------------------------------------------------------------------------------- /example/image-classification/symbol/mlp.py: -------------------------------------------------------------------------------- 1 | """ 2 | a simple multilayer perceptron 3 | """ 4 | import mxnet as mx 5 | 6 | def get_symbol(num_classes=10, **kwargs): 7 | data = mx.symbol.Variable('data') 8 | data = mx.sym.Flatten(data=data) 9 | fc1 = mx.symbol.FullyConnected(data = data, name='fc1', num_hidden=128) 10 | act1 = mx.symbol.Activation(data = fc1, name='relu1', act_type="relu") 11 | fc2 = mx.symbol.FullyConnected(data = act1, name = 'fc2', num_hidden = 64) 12 | act2 = mx.symbol.Activation(data = fc2, name='relu2', act_type="relu") 13 | fc3 = mx.symbol.FullyConnected(data = act2, name='fc3', num_hidden=num_classes) 14 | mlp = mx.symbol.SoftmaxOutput(data = fc3, name = 'softmax') 15 | return mlp 16 | -------------------------------------------------------------------------------- /example/image-classification/symbol_mlp.R: -------------------------------------------------------------------------------- 1 | library(mxnet) 2 | 3 | get_symbol <- function(num_classes = 1000) { 4 | data <- mx.symbol.Variable('data') 5 | fc1 <- mx.symbol.FullyConnected(data = data, name = 'fc1', num_hidden = 128) 6 | act1 <- mx.symbol.Activation(data = fc1, name = 'relu1', act_type = "relu") 7 | fc2 <- mx.symbol.FullyConnected(data = act1, name = 'fc2', num_hidden = 64) 8 | act2 <- mx.symbol.Activation(data = fc2, name = 'relu2', act_type = "relu") 9 | fc3 <- mx.symbol.FullyConnected(data = act2, name = 'fc3', num_hidden = num_classes) 10 | mlp <- mx.symbol.SoftmaxOutput(data = fc3, name = 'softmax') 11 | return(mlp) 12 | } 13 | -------------------------------------------------------------------------------- /example/memcost/Makefile: -------------------------------------------------------------------------------- 1 | 2 | .PHONY: no_optimization with_inplace with_sharing with_both 3 | 4 | no_optimization: 5 | @echo "Estimating the cost with no optimization..." 6 | @MXNET_EXEC_ENABLE_INPLACE=false MXNET_EXEC_MATCH_RANGE=0 python inception_memcost.py 7 | 8 | with_inplace: 9 | @echo "Estimating the cost with inplace optimization..." 10 | @MXNET_EXEC_ENABLE_INPLACE=true MXNET_EXEC_MATCH_RANGE=0 python inception_memcost.py 11 | 12 | with_sharing: 13 | @echo "Estimating the cost with memory sharing ..." 14 | @MXNET_EXEC_ENABLE_INPLACE=false python inception_memcost.py 15 | 16 | with_both: 17 | @echo "Estimating the cost with all optimizations ..." 18 | @python inception_memcost.py 19 | 20 | forward_only: 21 | @echo "Estimating the cost of forward only ..." 22 | @python inception_memcost.py 'null' 23 | -------------------------------------------------------------------------------- /example/model-parallel-lstm/README.md: -------------------------------------------------------------------------------- 1 | Model Parallel LSTM 2 | =================== 3 | This is an example showing how to do model parallel LSTM in MXNet. 4 | Most of the code is duplicated with the rnn example, and should be eventually merged. 5 | -------------------------------------------------------------------------------- /example/model-parallel-lstm/get_ptb_data.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | RNN_DIR=$(cd `dirname $0`; pwd) 4 | DATA_DIR="${RNN_DIR}/data/" 5 | 6 | if [[ ! -d "${DATA_DIR}" ]]; then 7 | echo "${DATA_DIR} doesn't exist, will create one"; 8 | mkdir -p ${DATA_DIR} 9 | fi 10 | 11 | wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/ptb/ptb.train.txt; 12 | wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/ptb/ptb.valid.txt; 13 | wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/ptb/ptb.test.txt; 14 | wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/tinyshakespeare/input.txt; 15 | -------------------------------------------------------------------------------- /example/multi-task/README.md: -------------------------------------------------------------------------------- 1 | # Mulit-task learning example 2 | 3 | This is a simple example to show how to use mxnet for multi-task learning. It uses MNIST as an example and mocks up the multi-label task. 4 | 5 | ## Usage 6 | First, you need to write a multi-task iterator on your own. The iterator needs to generate multiple labels according to your applications, and the label names should be specified in the `provide_label` function, which needs to be consist with the names of output layers. 7 | 8 | Then, if you want to show metrics of different tasks separately, you need to write your own metric class and specify the `num` parameter. In the `update` function of metric, calculate the metrics separately for different tasks. 9 | -------------------------------------------------------------------------------- /example/nce-loss/get_text8.sh: -------------------------------------------------------------------------------- 1 | mkdir -p ./data/ 2 | cd ./data/ 3 | wget http://mattmahoney.net/dc/text8.zip 4 | unzip text8.zip 5 | -------------------------------------------------------------------------------- /example/neural-style/.gitignore: -------------------------------------------------------------------------------- 1 | input 2 | output 3 | model 4 | -------------------------------------------------------------------------------- /example/neural-style/README.md: -------------------------------------------------------------------------------- 1 | # Neural art 2 | 3 | This is an implementation of the paper 4 | [A Neural Algorithm of Artistic Style](http://arxiv.org/abs/1508.06576) by Leon 5 | A. Gatys, Alexander S. Ecker, and Matthias Bethge. 6 | 7 | ## How to use 8 | 9 | First use `download.sh` to download pre-trained model and sample inputs 10 | 11 | Then run `python nstyle.py`, use `-h` to see more options 12 | 13 | ## Sample results 14 | 15 | 16 | 17 | It takes 30 secs for a Titan X to generate the above 600x400 image. 18 | 19 | ## Note 20 | 21 | * The current implementation is based the 22 | [torch implementation](https://github.com/jcjohnson/neural-style). But we may 23 | change it dramatically in the near future. 24 | 25 | * We will release multi-GPU version soon. 26 | -------------------------------------------------------------------------------- /example/neural-style/download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p model 4 | cd model 5 | wget https://github.com/dmlc/web-data/raw/master/mxnet/neural-style/model/vgg19.params 6 | cd .. 7 | 8 | mkdir -p input 9 | cd input 10 | wget https://github.com/dmlc/web-data/raw/master/mxnet/neural-style/input/IMG_4343.jpg 11 | wget https://github.com/dmlc/web-data/raw/master/mxnet/neural-style/input/starry_night.jpg 12 | cd .. 13 | 14 | mkdir -p output 15 | -------------------------------------------------------------------------------- /example/neural-style/end_to_end/README.md: -------------------------------------------------------------------------------- 1 | # End to End Neural Art 2 | 3 | This is an implementation of blog: [http://dmlc.ml/mxnet/2016/06/20/end-to-end-neural-style.html](http://dmlc.ml/mxnet/2016/06/20/end-to-end-neural-style.html) 4 | 5 | 6 | We will release a Multi-GPU training code soon. 7 | 8 | ## How to use 9 | 10 | 11 | 1. First use `download.sh` to download pre-trained model and sample inputs 12 | 13 | 2. Then prepare training dataset according to the blog 14 | 15 | 3. Modify [boost_train.py](boost_train.py) 16 | 17 | ## Pretrained Model 18 | 19 | Weight [https://github.com/dmlc/web-data/raw/master/mxnet/art/model.zip](https://github.com/dmlc/web-data/raw/master/mxnet/art/model.zip) 20 | Inference [boost_inference.py](boost_inference.py) 21 | -------------------------------------------------------------------------------- /example/neural-style/find_mxnet.py: -------------------------------------------------------------------------------- 1 | try: 2 | import mxnet as mx 3 | except ImportError: 4 | import os, sys 5 | curr_path = os.path.abspath(os.path.dirname(__file__)) 6 | sys.path.append(os.path.join(curr_path, "../../python")) 7 | import mxnet as mx 8 | -------------------------------------------------------------------------------- /example/numpy-ops/README.md: -------------------------------------------------------------------------------- 1 | # Training MNIST With NumpyOp 2 | 3 | Uses the same setup as example/mnist/mlp.py. Except the loss symbol is 4 | custom defined with NumpyOp. mxnet.operator.NumpyOp help move computation 5 | in a symbol's forward/backward operation to python frontend. This is for 6 | fast implementation/experimentation of non-performance-critical symbols. 7 | If it is becoming a bottleneck, please consider write a C++/CUDA version. -------------------------------------------------------------------------------- /example/python-howto/README.md: -------------------------------------------------------------------------------- 1 | Python Howto Examples 2 | ===================== 3 | * [Configuring Net to get Multiple Ouputs](multiple_outputs.py) 4 | * [Configuring Image Record Iterator](data_iter.py) 5 | -------------------------------------------------------------------------------- /example/python-howto/multiple_outputs.py: -------------------------------------------------------------------------------- 1 | """Create a Multiple output configuration. 2 | 3 | This example shows how to create a multiple output configuration. 4 | """ 5 | import mxnet as mx 6 | 7 | net = mx.symbol.Variable('data') 8 | fc1 = mx.symbol.FullyConnected(data=net, name='fc1', num_hidden=128) 9 | net = mx.symbol.Activation(data=fc1, name='relu1', act_type="relu") 10 | net = mx.symbol.FullyConnected(data=net, name='fc2', num_hidden=64) 11 | out = mx.symbol.SoftmaxOutput(data=net, name='softmax') 12 | # group fc1 and out together 13 | group = mx.symbol.Group([fc1, out]) 14 | print group.list_outputs() 15 | 16 | # You can go ahead and bind on the group 17 | # executor = group.simple_bind(data=data_shape) 18 | # executor.forward() 19 | # executor.output[0] will be value of fc1 20 | # executor.output[1] will be value of softmax 21 | -------------------------------------------------------------------------------- /example/rcnn/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/rcnn/__init__.py -------------------------------------------------------------------------------- /example/rcnn/helper/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/rcnn/helper/__init__.py -------------------------------------------------------------------------------- /example/rcnn/helper/dataset/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/rcnn/helper/dataset/__init__.py -------------------------------------------------------------------------------- /example/rcnn/helper/processing/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/rcnn/helper/processing/__init__.py -------------------------------------------------------------------------------- /example/rcnn/helper/processing/bbox_process.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | 4 | def unique_boxes(boxes, scale=1.0): 5 | """ return indices of unique boxes """ 6 | v = np.array([1, 1e3, 1e6, 1e9]) 7 | hashes = np.round(boxes * scale).dot(v) 8 | _, index = np.unique(hashes, return_index=True) 9 | return np.sort(index) 10 | 11 | 12 | def filter_small_boxes(boxes, min_size): 13 | w = boxes[:, 2] - boxes[:, 0] 14 | h = boxes[:, 3] - boxes[:, 1] 15 | keep = np.where((w >= min_size) & (h > min_size))[0] 16 | return keep 17 | -------------------------------------------------------------------------------- /example/rcnn/rcnn/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/rcnn/rcnn/__init__.py -------------------------------------------------------------------------------- /example/rcnn/rcnn/rpn/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/rcnn/rcnn/rpn/__init__.py -------------------------------------------------------------------------------- /example/rcnn/test.py: -------------------------------------------------------------------------------- 1 | import mxnet as mx 2 | 3 | from tools.test_rcnn import test_rcnn 4 | from tools.test_rcnn import parse_args 5 | 6 | if __name__ == '__main__': 7 | args = parse_args() 8 | ctx = mx.gpu(args.gpu_id) 9 | test_rcnn(args.image_set, args.year, args.root_path, args.devkit_path, args.prefix, args.epoch, ctx, args.vis, 10 | args.has_rpn) 11 | -------------------------------------------------------------------------------- /example/rcnn/test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/rcnn/test/__init__.py -------------------------------------------------------------------------------- /example/rcnn/test/test_data_iter.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from helper.dataset import pascal_voc 4 | from helper.processing import roidb 5 | from rcnn import data_iter 6 | 7 | # test flip 8 | devkit_path = os.path.join(os.path.expanduser('~'), 'Dataset', 'VOCdevkit') 9 | voc = pascal_voc.PascalVOC('trainval', '2007', devkit_path) 10 | gt_roidb = voc.gt_roidb() 11 | ss_roidb = voc.selective_search_roidb(gt_roidb) 12 | ss_roidb = voc.append_flipped_images(ss_roidb) 13 | roidb.prepare_roidb(voc, ss_roidb) 14 | means, stds = roidb.add_bbox_regression_targets(ss_roidb) 15 | 16 | roi_iter = data_iter.ROIIter(ss_roidb, shuffle=True) 17 | 18 | for j in range(0, 20): 19 | print j 20 | for databatch in roi_iter: 21 | i = 0 22 | roi_iter.reset() 23 | -------------------------------------------------------------------------------- /example/rcnn/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/rcnn/tools/__init__.py -------------------------------------------------------------------------------- /example/rcnn/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/rcnn/utils/__init__.py -------------------------------------------------------------------------------- /example/rcnn/utils/combine_model.py: -------------------------------------------------------------------------------- 1 | from load_model import load_checkpoint 2 | from save_model import save_checkpoint 3 | 4 | 5 | def combine_model(prefix1, epoch1, prefix2, epoch2, prefix_out, epoch_out): 6 | args1, auxs1 = load_checkpoint(prefix1, epoch1) 7 | args2, auxs2 = load_checkpoint(prefix2, epoch2) 8 | arg_names = args1.keys() + args2.keys() 9 | aux_names = auxs1.keys() + auxs2.keys() 10 | args = dict() 11 | for arg in arg_names: 12 | if arg in args1: 13 | args[arg] = args1[arg] 14 | else: 15 | args[arg] = args2[arg] 16 | auxs = dict() 17 | for aux in aux_names: 18 | if aux in auxs1: 19 | auxs[aux] = auxs1[aux] 20 | else: 21 | auxs[aux] = auxs2[aux] 22 | save_checkpoint(prefix_out, epoch_out, args, auxs) 23 | -------------------------------------------------------------------------------- /example/rcnn/utils/save_model.py: -------------------------------------------------------------------------------- 1 | import mxnet as mx 2 | 3 | 4 | def save_checkpoint(prefix, epoch, arg_params, aux_params): 5 | """Checkpoint the model data into file. 6 | :param prefix: Prefix of model name. 7 | :param epoch: The epoch number of the model. 8 | :param arg_params: dict of str to NDArray 9 | Model parameter, dict of name to NDArray of net's weights. 10 | :param aux_params: dict of str to NDArray 11 | Model parameter, dict of name to NDArray of net's auxiliary states. 12 | :return: None 13 | prefix-epoch.params will be saved for parameters. 14 | """ 15 | save_dict = {('arg:%s' % k) : v for k, v in arg_params.items()} 16 | save_dict.update({('aux:%s' % k) : v for k, v in aux_params.items()}) 17 | param_name = '%s-%04d.params' % (prefix, epoch) 18 | mx.nd.save(param_name, save_dict) 19 | -------------------------------------------------------------------------------- /example/recommenders/.gitignore: -------------------------------------------------------------------------------- 1 | ml-100k.zip 2 | ml-100k 3 | -------------------------------------------------------------------------------- /example/reinforcement-learning/ddpg/README.md: -------------------------------------------------------------------------------- 1 | # mx-DDPG 2 | MXNet Implementation of DDPG 3 | 4 | # Introduction 5 | 6 | This is the MXNet implementation of [DDPG](https://arxiv.org/abs/1509.02971). It is tested in the rllab cart pole environment against rllab's native implementation and achieves comparably similar results. You can substitute with this anywhere you use rllab's DDPG with minor modifications. 7 | 8 | # Dependency 9 | 10 | * rllab 11 | 12 | # Usage 13 | 14 | To run the algorithm, 15 | 16 | ```python 17 | python run.py 18 | ``` 19 | 20 | The implementation relies on rllab for environments and logging and the hyperparameters could be set in ```run.py```. 21 | 22 | # References 23 | 24 | 1. [Lillicrap, Timothy P., et al. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971 (2015)](https://arxiv.org/abs/1509.02971). 25 | 2. rllab. URL: [https://github.com/openai/rllab](https://github.com/openai/rllab) 26 | -------------------------------------------------------------------------------- /example/reinforcement-learning/ddpg/run.py: -------------------------------------------------------------------------------- 1 | from ddpg import DDPG 2 | from rllab.envs.box2d.cartpole_env import CartpoleEnv 3 | from rllab.envs.normalized_env import normalize 4 | from policies import DeterministicMLPPolicy 5 | from qfuncs import ContinuousMLPQ 6 | from strategies import OUStrategy 7 | from utils import SEED 8 | import mxnet as mx 9 | 10 | # set environment, policy, qfunc, strategy 11 | 12 | env = normalize(CartpoleEnv()) 13 | 14 | policy = DeterministicMLPPolicy(env.spec) 15 | qfunc = ContinuousMLPQ(env.spec) 16 | strategy = OUStrategy(env.spec) 17 | 18 | # set the training algorithm and train 19 | 20 | algo = DDPG( 21 | env=env, 22 | policy=policy, 23 | qfunc=qfunc, 24 | strategy=strategy, 25 | ctx=mx.gpu(0), 26 | max_path_length=100, 27 | epoch_length=1000, 28 | memory_start_size=10000, 29 | n_epochs=1000, 30 | discount=0.99, 31 | qfunc_lr=1e-3, 32 | policy_lr=1e-4, 33 | seed=SEED) 34 | 35 | algo.train() -------------------------------------------------------------------------------- /example/reinforcement-learning/dqn/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/reinforcement-learning/dqn/README.md -------------------------------------------------------------------------------- /example/reinforcement-learning/dqn/game.py: -------------------------------------------------------------------------------- 1 | 2 | DEFAULT_MAX_EPISODE_STEP = 1000000 3 | 4 | class Game(object): 5 | def __init__(self): 6 | self.total_reward = 0 7 | self.episode_reward = 0 8 | self.episode_step = 0 9 | self.max_episode_step = DEFAULT_MAX_EPISODE_STEP 10 | 11 | def start(self): 12 | raise NotImplementedError("Must Implement!") 13 | 14 | def begin_episode(self, max_episode_step): 15 | raise NotImplementedError("Must Implement!") 16 | 17 | @property 18 | def episode_terminate(self): 19 | raise NotImplementedError 20 | 21 | def get_observation(self): 22 | raise NotImplementedError 23 | 24 | @property 25 | def state_enabled(self): 26 | raise NotImplementedError 27 | 28 | def current_state(self): 29 | return self.replay_memory.latest_slice() 30 | 31 | def play(self, a): 32 | raise NotImplementedError -------------------------------------------------------------------------------- /example/rnn/README.md: -------------------------------------------------------------------------------- 1 | RNN Example 2 | =========== 3 | This folder contains RNN examples using low level symbol interface. 4 | 5 | ## Python 6 | 7 | - [lstm.py](lstm.py) Functions for building a LSTM Network 8 | - [gru.py](gru.py) Functions for building a GRU Network 9 | - [lstm_bucketing.py](lstm_bucketing.py) PennTreeBank language model by using LSTM 10 | - [gru_bucketing.py](gru_bucketing.py) PennTreeBank language model by using GRU 11 | - [char-rnn.ipynb](char-rnn.ipynb) Notebook to demo how to train a character LSTM by using ```lstm.py``` 12 | 13 | 14 | Performance Note: 15 | More ```MXNET_GPU_WORKER_NTHREADS``` may lead to better performance. For setting ```MXNET_GPU_WORKER_NTHREADS```, please refer to [Environment Variables](https://mxnet.readthedocs.org/en/latest/how_to/env_var.html). 16 | -------------------------------------------------------------------------------- /example/rnn/get_ptb_data.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | RNN_DIR=$(cd `dirname $0`; pwd) 4 | DATA_DIR="${RNN_DIR}/data/" 5 | 6 | if [[ ! -d "${DATA_DIR}" ]]; then 7 | echo "${DATA_DIR} doesn't exist, will create one"; 8 | mkdir -p ${DATA_DIR} 9 | fi 10 | 11 | wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/ptb/ptb.train.txt; 12 | wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/ptb/ptb.valid.txt; 13 | wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/ptb/ptb.test.txt; 14 | wget -P ${DATA_DIR} https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/tinyshakespeare/input.txt; 15 | -------------------------------------------------------------------------------- /example/speech-demo/io_func/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/speech-demo/io_func/__init__.py -------------------------------------------------------------------------------- /example/speech-demo/io_func/feat_readers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/speech-demo/io_func/feat_readers/__init__.py -------------------------------------------------------------------------------- /example/speech-demo/io_func/info.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | _mydir = os.path.dirname(__file__) or '.' 4 | 5 | ROOT = os.path.abspath(os.path.join(_mydir, "../..")) 6 | CONFIGS = os.path.join(ROOT, "configs") 7 | -------------------------------------------------------------------------------- /example/speech-demo/python_wrap/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | all: 4 | 5 | include ../kaldi.mk 6 | 7 | OBJFILES = ctypes.o 8 | 9 | LIBNAME = kaldi-python-wrap 10 | 11 | ADDLIBS = ../util/kaldi-util.a ../matrix/kaldi-matrix.a ../base/kaldi-base.a ../hmm/kaldi-hmm.a ../cudamatrix/kaldi-cudamatrix.a ../nnet/kaldi-nnet.a ../thread/kaldi-thread.a 12 | 13 | include ../makefiles/default_rules.mk 14 | -------------------------------------------------------------------------------- /example/speech-demo/python_wrap/example_usage/README.txt: -------------------------------------------------------------------------------- 1 | # If not already done, make sure kaldi/src is compiled as shared libraries 2 | cd kaldi/src 3 | ./configure --shared 4 | make depend 5 | make 6 | 7 | # Copy python_wrap/ to kaldi/src and compile it 8 | cd python_wrap/ 9 | make 10 | 11 | cd example_usage/ 12 | # Add kaldi/src/lib to LD_LIBRARY_PATH 13 | export LD_LIBRARY_PATH=../../lib:$LD_LIBRARY_PATH 14 | python example.py -------------------------------------------------------------------------------- /example/speech-demo/python_wrap/example_usage/data.ark: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/speech-demo/python_wrap/example_usage/data.ark -------------------------------------------------------------------------------- /example/speech-demo/python_wrap/example_usage/data.scp: -------------------------------------------------------------------------------- 1 | test_feat data.ark:10 2 | -------------------------------------------------------------------------------- /example/speech-demo/python_wrap/example_usage/data.txt: -------------------------------------------------------------------------------- 1 | test_feat [ 2 | 1.2345 6.789 3 | -9.876 0.0001 ] 4 | -------------------------------------------------------------------------------- /example/speech-demo/tests/test_nothing.py: -------------------------------------------------------------------------------- 1 | def test_nothing(): 2 | pass -------------------------------------------------------------------------------- /example/ssd/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/ssd/__init__.py -------------------------------------------------------------------------------- /example/ssd/config/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/ssd/config/__init__.py -------------------------------------------------------------------------------- /example/ssd/data/demo/download_demo_images.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | wd = os.path.dirname(os.path.realpath(__file__)) 4 | 5 | def download(url, target): 6 | os.system("wget {} -O {}".format(url, target)) 7 | 8 | if __name__ == "__main__": 9 | base_url = "https://cloud.githubusercontent.com/assets/3307514/" 10 | demo_list = {"20012566/cbb53c76-a27d-11e6-9aaa-91939c9a1cd5.jpg":"000001.jpg", 11 | "20012564/cbb43894-a27d-11e6-9619-ba792b66c4ae.jpg": "000002.jpg", 12 | "20012565/cbb53942-a27d-11e6-996c-125bb060a81d.jpg": "000004.jpg", 13 | "20012562/cbb4136e-a27d-11e6-884c-ed83c165b422.jpg": "000010.jpg", 14 | "20012567/cbb60336-a27d-11e6-93ff-cbc3f09f5c9e.jpg": "dog.jpg", 15 | "20012563/cbb41382-a27d-11e6-92a9-18dab4fd1ad3.jpg": "person.jpg", 16 | "20012568/cbc2d6f6-a27d-11e6-94c3-d35a9cb47609.jpg": "street.jpg"} 17 | for k, v in demo_list.items(): 18 | download(base_url + k, os.path.join(wd, v)) 19 | -------------------------------------------------------------------------------- /example/ssd/dataset/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/ssd/dataset/__init__.py -------------------------------------------------------------------------------- /example/ssd/detect/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/ssd/detect/__init__.py -------------------------------------------------------------------------------- /example/ssd/evaluate/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/ssd/evaluate/__init__.py -------------------------------------------------------------------------------- /example/ssd/model/README.md: -------------------------------------------------------------------------------- 1 | #### This is the default directory to store all the models, including `*.params` and `*.json` 2 | -------------------------------------------------------------------------------- /example/ssd/symbol/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/ssd/symbol/__init__.py -------------------------------------------------------------------------------- /example/ssd/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/ssd/tools/__init__.py -------------------------------------------------------------------------------- /example/ssd/tools/find_mxnet.py: -------------------------------------------------------------------------------- 1 | try: 2 | import mxnet as mx 3 | except ImportError: 4 | import os, sys 5 | curr_path = os.path.abspath(os.path.dirname(__file__)) 6 | sys.path.append(os.path.join(curr_path, "../../../python")) 7 | import mxnet as mx 8 | -------------------------------------------------------------------------------- /example/ssd/train/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/example/ssd/train/__init__.py -------------------------------------------------------------------------------- /example/ssd/train/initializer.py: -------------------------------------------------------------------------------- 1 | import mxnet as mx 2 | 3 | 4 | class ScaleInitializer(mx.init.Initializer): 5 | """ 6 | Customized initializer for scale layer 7 | """ 8 | def __init__(self): 9 | pass 10 | 11 | def _init_default(self, name, arr): 12 | if name.endswith("scale"): 13 | self._init_one(name, arr) 14 | else: 15 | raise ValueError('Unknown initialization pattern for %s' % name) 16 | -------------------------------------------------------------------------------- /example/svm_mnist/README.md: -------------------------------------------------------------------------------- 1 | # Use case with Support Vector Machine 2 | 3 | To ensure that not only the implementation is learning, but is able to outsmart the softmax, as [this article](arxiv.org/pdf/1306.0239.pdf) suggests, I ran svm_mnist.py script. It was based on the MNIST experiment description on the article and [this tutorial](https://github.com/dmlc/mxnet-gtc-tutorial/blob/master/tutorial.ipynb). 4 | 5 | 6 | ## To this you will need 7 | 8 | * [Numpy](http://www.scipy.org/scipylib/download.html) 9 | * [Sklearn](http://scikit-learn.org/stable/install.html) 10 | 11 | I recommend installing [matplot](http://matplotlib.org/users/installing.html) to visualize examples -------------------------------------------------------------------------------- /example/torch/torch_function.py: -------------------------------------------------------------------------------- 1 | import mxnet as mx 2 | x = mx.th.randn(2, 2, ctx=mx.cpu(0)) 3 | print x.asnumpy() 4 | y = mx.th.abs(x) 5 | print y.asnumpy() 6 | 7 | x = mx.th.randn(2, 2, ctx=mx.cpu(0)) 8 | print x.asnumpy() 9 | mx.th.abs(x, x) # in-place 10 | print x.asnumpy() 11 | 12 | x = mx.th.ones(2, 2, ctx=mx.cpu(0)) 13 | y = mx.th.ones(2, 2, ctx=mx.cpu(0))*2 14 | print mx.th.cdiv(x,y).asnumpy() 15 | -------------------------------------------------------------------------------- /matlab/+mxnet/private/callmxnet.m: -------------------------------------------------------------------------------- 1 | function callmxnet(func, varargin) 2 | %CALLMXNET call mxnet functions 3 | 4 | if ~libisloaded('libmxnet') 5 | cur_pwd = pwd; 6 | mxnet_root = [fileparts(mfilename('fullpath')), '/../../../']; 7 | cd(mxnet_root); 8 | mxnet_root = pwd; 9 | cd(cur_pwd); 10 | assert(exist([mxnet_root, '/lib/libmxnet.so'], 'file') == 2 || ... 11 | exist([mxnet_root, '/lib/libmxnet.dylib'], 'file') == 2 || ... 12 | exist([mxnet_root, '/lib/libmxnet.dll'], 'file') == 2, ... 13 | 'you need to build mxnet first'); 14 | assert(exist([mxnet_root, '/include/mxnet/c_predict_api.h']) == 2, ... 15 | 'failed to find c_predict_api.h') 16 | addpath([mxnet_root, '/lib']) 17 | addpath([mxnet_root, '/include/mxnet']) 18 | 19 | [err, warn] = loadlibrary('libmxnet', 'c_predict_api.h'); 20 | assert(isempty(err)); 21 | if warn, warn, end 22 | end 23 | 24 | assert(ischar(func)) 25 | ret = calllib('libmxnet', func, varargin{:}); 26 | assert(ret == 0) 27 | end 28 | -------------------------------------------------------------------------------- /plugin/caffe/caffe.mk: -------------------------------------------------------------------------------- 1 | CFLAGS += -I$(CAFFE_PATH)/include -I$(CAFFE_PATH)/build/src 2 | LDFLAGS += -lprotobuf -lboost_system -lboost_thread -lboost_filesystem -lgflags -lglog -L$(CAFFE_PATH)/build/lib -lcaffe 3 | 4 | ifeq ($(USE_CUDNN), 1) 5 | CFLAGS += -DUSE_CUDNN=1 6 | endif 7 | 8 | ifeq ($(USE_CUDA), 0) 9 | CFLAGS += -DCPU_ONLY=1 10 | endif 11 | 12 | CAFFE_SRC = $(wildcard plugin/caffe/*.cc) 13 | PLUGIN_OBJ += $(patsubst %.cc, build/%.o, $(CAFFE_SRC)) 14 | CAFFE_CUSRC = $(wildcard plugin/caffe/*.cu) 15 | PLUGIN_CUOBJ += $(patsubst %.cu, build/%_gpu.o, $(CAFFE_CUSRC)) 16 | -------------------------------------------------------------------------------- /plugin/caffe/caffe_common.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2016 by Contributors 3 | * \file caffe_common.h 4 | * \brief Common functions for caffeOp and caffeLoss symbols 5 | * \author Haoran Wang 6 | */ 7 | #include 8 | #include 9 | #include"caffe_common.h" 10 | 11 | namespace mxnet { 12 | namespace op { 13 | namespace caffe { 14 | 15 | // Cpu implementation of set_mode 16 | template<> 17 | void CaffeMode::SetMode() { 18 | ::caffe::Caffe::set_mode(::caffe::Caffe::CPU); 19 | } 20 | 21 | // Gpu implementation of set_mode 22 | template<> 23 | void CaffeMode::SetMode() { 24 | ::caffe::Caffe::set_mode(::caffe::Caffe::GPU); 25 | } 26 | 27 | } // namespace caffe 28 | } // namespace op 29 | } // namespace mxnet 30 | -------------------------------------------------------------------------------- /plugin/caffe/caffe_loss.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2016 by Contributors 3 | * \file caffe_loss_gpu.cc 4 | * \brief caffe loss 5 | * \author Haoran Wang 6 | */ 7 | #include "./caffe_loss-inl.h" 8 | 9 | namespace mxnet { 10 | namespace op { 11 | template<> 12 | Operator* CreateOp(CaffeLossParam param, int dtype) { 13 | Operator *op = NULL; 14 | switch (dtype) { 15 | case mshadow::kFloat32: 16 | op = new CaffeLoss(param); 17 | break; 18 | case mshadow::kFloat64: 19 | op = new CaffeLoss(param); 20 | break; 21 | case mshadow::kFloat16: 22 | LOG(FATAL) << "float16 layer is not supported by caffe"; 23 | break; 24 | default: 25 | LOG(FATAL) << "Unsupported type " << dtype; 26 | } 27 | return op; 28 | } 29 | 30 | } // namespace op 31 | } // namespace mxnet 32 | -------------------------------------------------------------------------------- /plugin/caffe/caffe_op.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2016 by Contributors 3 | * \file caffe_operator_gpu.cc 4 | * \brief caffe operator 5 | * \author Haoran Wang 6 | */ 7 | #include "./caffe_op-inl.h" 8 | namespace mxnet { 9 | namespace op { 10 | 11 | template<> 12 | Operator *CreateOp(CaffeOpParam param, int dtype) { 13 | Operator *op = NULL; 14 | switch (dtype) { 15 | case mshadow::kFloat32: 16 | op = new CaffeOp(param); 17 | break; 18 | case mshadow::kFloat64: 19 | op = new CaffeOp(param); 20 | break; 21 | case mshadow::kFloat16: 22 | LOG(FATAL) << "float16 layer is not supported by caffe"; 23 | break; 24 | default: 25 | LOG(FATAL) << "Unsupported type " << dtype; 26 | } 27 | return op; 28 | } 29 | 30 | } // namespace op 31 | } // namespace mxnet 32 | -------------------------------------------------------------------------------- /plugin/caffe/caffe_stream.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2016 by Contributors 3 | * \file caffe_stream.cc 4 | * \brief define stream opertors >> and << 5 | * \author Haoran Wang 6 | */ 7 | #include"caffe_stream.h" 8 | 9 | namespace dmlc { 10 | namespace parameter { 11 | std::istringstream &operator>>(std::istringstream &is, ::caffe::LayerParameter ¶_) { 12 | return is; 13 | } 14 | std::ostream &operator<<(std::ostream &os, ::caffe::LayerParameter ¶_) { 15 | return os; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /plugin/caffe/caffe_stream.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2016 by Contributors 3 | * \file caffe_stream.h 4 | * \brief define stream opertors >> and << 5 | * \author Haoran Wang 6 | */ 7 | #ifndef PLUGIN_CAFFE_CAFFE_STREAM_H_ 8 | #define PLUGIN_CAFFE_CAFFE_STREAM_H_ 9 | 10 | #include 11 | #include 12 | namespace dmlc { 13 | namespace parameter { 14 | std::istringstream &operator>>(std::istringstream &is, ::caffe::LayerParameter ¶_); 15 | std::ostream &operator<<(std::ostream &os, ::caffe::LayerParameter ¶_); 16 | } 17 | } 18 | 19 | #endif // PLUGIN_CAFFE_CAFFE_STREAM_H_ 20 | -------------------------------------------------------------------------------- /plugin/opencv/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | # pylint: disable=wildcard-import 3 | 4 | """Opencv plugin for mxnet""" 5 | from .opencv import * 6 | 7 | -------------------------------------------------------------------------------- /plugin/opencv/cv_api.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2016 by Contributors 3 | * \file cv_api.h 4 | * \brief C API for opencv 5 | * \author Junyuan Xie 6 | */ 7 | #ifndef PLUGIN_OPENCV_CV_API_H_ 8 | #define PLUGIN_OPENCV_CV_API_H_ 9 | 10 | #include 11 | 12 | MXNET_DLL int MXCVImdecode( 13 | const unsigned char *img, 14 | const mx_uint len, 15 | const int flag, 16 | NDArrayHandle *out); 17 | 18 | MXNET_DLL int MXCVResize( 19 | NDArrayHandle src, 20 | const mx_uint w, 21 | const mx_uint h, 22 | const int interpolation, 23 | NDArrayHandle *out); 24 | 25 | MXNET_DLL int MXCVcopyMakeBorder( 26 | NDArrayHandle src, 27 | const int top, 28 | const int bot, 29 | const int left, 30 | const int right, 31 | const int type, 32 | const double value, 33 | NDArrayHandle *out); 34 | 35 | #endif // PLUGIN_OPENCV_CV_API_H_ 36 | -------------------------------------------------------------------------------- /plugin/opencv/opencv.mk: -------------------------------------------------------------------------------- 1 | OPENCV_SRC = $(wildcard plugin/opencv/*.cc) 2 | PLUGIN_OBJ += $(patsubst %.cc, build/%.o, $(OPENCV_SRC)) 3 | OPENCV_CUSRC = $(wildcard plugin/opencv/*.cu) 4 | PLUGIN_CUOBJ += $(patsubst %.cu, build/%_gpu.o, $(OPENCV_CUSRC)) 5 | -------------------------------------------------------------------------------- /plugin/sframe/plugin.mk: -------------------------------------------------------------------------------- 1 | SFRMAE_SRC = plugin/sframe/iter_sframe.cc 2 | PLUGIN_OBJ += build/plugin/sframe/iter_sframe.o 3 | CFLAGS += -I$(SFRAME_PATH)/oss_src/unity/lib/ 4 | CFLAGS += -I$(SFRAME_PATH)/oss_src/ 5 | LDFLAGS += -L$(SFRAME_PATH)/release/oss_src/unity/python/sframe/ 6 | LDFLAGS += -lunity_shared 7 | LDFLAGS += -lboost_system 8 | -------------------------------------------------------------------------------- /plugin/torch/torch.mk: -------------------------------------------------------------------------------- 1 | CFLAGS += -I$(TORCH_PATH)/install/include -I$(TORCH_PATH)/install/include/TH -I$(TORCH_PATH)/install/include/THC/ -DMXNET_USE_TORCH=1 2 | LDFLAGS += -L$(TORCH_PATH)/install/lib -lluajit -lluaT -lTH -lTHC 3 | 4 | TORCH_SRC = $(wildcard plugin/torch/*.cc) 5 | PLUGIN_OBJ += $(patsubst %.cc, build/%.o, $(TORCH_SRC)) 6 | TORCH_CUSRC = $(wildcard plugin/torch/*.cu) 7 | PLUGIN_CUOBJ += $(patsubst %.cu, build/%_gpu.o, $(TORCH_CUSRC)) 8 | -------------------------------------------------------------------------------- /plugin/torch/torch_criterion.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file activation.cc 4 | * \brief activation op 5 | * \author Junyuan Xie 6 | */ 7 | #include "./torch_criterion-inl.h" 8 | #include "../../src/operator/mshadow_op.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template<> 13 | Operator *CreateOp(TorchCriterionParam param) { 14 | return new TorchCriterionOp(param); 15 | } 16 | 17 | // DO_BIND_DISPATCH comes from operator_common.h 18 | Operator *TorchCriterionProp::CreateOperator(Context ctx) const { 19 | DO_BIND_DISPATCH(CreateOp, param_); 20 | } 21 | 22 | DMLC_REGISTER_PARAMETER(TorchCriterionParam); 23 | 24 | MXNET_REGISTER_OP_PROPERTY(TorchCriterion, TorchCriterionProp) 25 | .describe("Criterions from torch.") 26 | .add_arguments(TorchCriterionParam::__FIELDS__()); 27 | 28 | } // namespace op 29 | } // namespace mxnet 30 | -------------------------------------------------------------------------------- /plugin/torch/torch_criterion.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file activation.cc 4 | * \brief activation op 5 | * \author Bing Xu 6 | */ 7 | #include "./torch_criterion-inl.h" 8 | #include "../../src/operator/mshadow_op.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template<> 13 | Operator *CreateOp(TorchCriterionParam param) { 14 | return new TorchCriterionOp(param); 15 | } 16 | 17 | } // namespace op 18 | } // namespace mxnet 19 | -------------------------------------------------------------------------------- /plugin/torch/torch_module.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file activation.cc 4 | * \brief activation op 5 | * \author Bing Xu 6 | */ 7 | #include "./torch_module-inl.h" 8 | #include "../../src/operator/mshadow_op.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template<> 13 | Operator *CreateOp(TorchModuleParam param, TorchState* torchState) { 14 | return new TorchModuleOp(param, torchState); 15 | } 16 | 17 | // DO_BIND_DISPATCH comes from operator_common.h 18 | Operator *TorchModuleProp::CreateOperator(Context ctx) const { 19 | DO_BIND_DISPATCH(CreateOp, param_, torchState_); 20 | } 21 | 22 | DMLC_REGISTER_PARAMETER(TorchModuleParam); 23 | 24 | MXNET_REGISTER_OP_PROPERTY(TorchModule, TorchModuleProp) 25 | .describe("Modules from torch.") 26 | .add_arguments(TorchModuleParam::__FIELDS__()); 27 | 28 | } // namespace op 29 | } // namespace mxnet 30 | -------------------------------------------------------------------------------- /plugin/torch/torch_module.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file activation.cc 4 | * \brief activation op 5 | * \author Bing Xu 6 | */ 7 | #include "./torch_module-inl.h" 8 | #include "../../src/operator/mshadow_op.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template<> 13 | Operator *CreateOp(TorchModuleParam param, TorchState* torchState) { 14 | return new TorchModuleOp(param, torchState); 15 | } 16 | 17 | } // namespace op 18 | } // namespace mxnet 19 | -------------------------------------------------------------------------------- /plugin/warpctc/warpctc.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file warpctc.cc 4 | * \brief warpctc op 5 | * \author Liang Xiang 6 | */ 7 | 8 | #include "./warpctc-inl.h" 9 | #include "../../src/operator/mshadow_op.h" 10 | 11 | namespace mxnet { 12 | namespace op { 13 | template<> 14 | Operator *CreateOp(WarpCTCParam param) { 15 | return new WarpCTCOp(param); 16 | } 17 | 18 | Operator *WarpCTCProp::CreateOperator(Context ctx) const { 19 | DO_BIND_DISPATCH(CreateOp, param_); 20 | } 21 | 22 | DMLC_REGISTER_PARAMETER(WarpCTCParam); 23 | 24 | MXNET_REGISTER_OP_PROPERTY(WarpCTC, WarpCTCProp) 25 | .describe("warp ctc.") 26 | .add_arguments(WarpCTCParam::__FIELDS__()); 27 | 28 | } // namespace op 29 | } // namespace mxnet 30 | -------------------------------------------------------------------------------- /plugin/warpctc/warpctc.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file warpctc.cc 4 | * \brief warpctc op 5 | * \author Liang Xiang 6 | */ 7 | #include "./warpctc-inl.h" 8 | #include 9 | #include "../../src/operator/mshadow_op.h" 10 | 11 | namespace mxnet { 12 | namespace op { 13 | template<> 14 | Operator *CreateOp(WarpCTCParam param) { 15 | return new WarpCTCOp(param); 16 | } 17 | 18 | } // namespace op 19 | } // namespace mxnet 20 | -------------------------------------------------------------------------------- /plugin/warpctc/warpctc.mk: -------------------------------------------------------------------------------- 1 | CFLAGS += -I$(WARPCTC_PATH)/include 2 | LDFLAGS += -L$(WARPCTC_PATH)/build -lwarpctc 3 | 4 | WARPCTC_SRC = $(wildcard plugin/warpctc/*.cc) 5 | PLUGIN_OBJ += $(patsubst %.cc, build/%.o, $(WARPCTC_SRC)) 6 | WARPCTC_CUSRC = $(wildcard plugin/warpctc/*.cu) 7 | PLUGIN_CUOBJ += $(patsubst %.cu, build/%_gpu.o, $(WARPCTC_CUSRC)) 8 | -------------------------------------------------------------------------------- /python/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | *.egg-info 3 | build 4 | -------------------------------------------------------------------------------- /python/README.md: -------------------------------------------------------------------------------- 1 | MXNet Python Package 2 | ==================== 3 | MXNet is a deep learning framework designed for both *efficiency* and *flexibility*. 4 | It allows you to mix the flavours of deep learning programs together to maximize the efficiency and your productivity. 5 | 6 | 7 | Installation 8 | ------------ 9 | To install, check [Build Instruction](http://mxnet.io/get_started/setup.html) 10 | -------------------------------------------------------------------------------- /python/mxnet/_ndarray_internal.py: -------------------------------------------------------------------------------- 1 | """NDArray namespace used to register internal functions""" 2 | -------------------------------------------------------------------------------- /python/mxnet/_symbol_internal.py: -------------------------------------------------------------------------------- 1 | """Symbol namespace used to register internal functions""" 2 | -------------------------------------------------------------------------------- /python/mxnet/module/__init__.py: -------------------------------------------------------------------------------- 1 | """A module is like a FeedForward model. but we would like to make it 2 | easier to be composed. So it is more like the Torch modules. 3 | """ 4 | 5 | from .base_module import BaseModule 6 | from .module import Module 7 | from .bucketing_module import BucketingModule 8 | from .sequential_module import SequentialModule 9 | 10 | from .python_module import PythonModule, PythonLossModule 11 | -------------------------------------------------------------------------------- /python/mxnet/notebook/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=invalid-name, missing-docstring, no-init, old-style-class, multiple-statements 2 | 3 | """MXNet notebook: an easy to use visualization platform""" 4 | 5 | try: 6 | import bokeh 7 | except ImportError: 8 | class Bokeh_Failed_To_Import: pass 9 | bokeh = Bokeh_Failed_To_Import 10 | 11 | try: 12 | import boken.io 13 | except ImportError: 14 | pass 15 | -------------------------------------------------------------------------------- /python/setup.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=invalid-name, exec-used 2 | """Setup mxnet package.""" 3 | from __future__ import absolute_import 4 | import os 5 | from setuptools import setup 6 | 7 | # We can not import `mxnet.info.py` in setup.py directly since mxnet/__init__.py 8 | # Will be invoked which introduces dependences 9 | CURRENT_DIR = os.path.dirname(__file__) 10 | libinfo_py = os.path.join(CURRENT_DIR, 'mxnet/libinfo.py') 11 | libinfo = {'__file__': libinfo_py} 12 | exec(compile(open(libinfo_py, "rb").read(), libinfo_py, 'exec'), libinfo, libinfo) 13 | 14 | LIB_PATH = libinfo['find_lib_path']() 15 | __version__ = libinfo['__version__'] 16 | 17 | setup(name='mxnet', 18 | version=__version__, 19 | description=open(os.path.join(CURRENT_DIR, 'README.md')).read(), 20 | install_requires=[ 21 | 'numpy', 22 | ], 23 | zip_safe=False, 24 | packages=['mxnet', 'mxnet.module'], 25 | data_files=[('mxnet', [LIB_PATH[0]])], 26 | url='https://github.com/dmlc/mxnet') 27 | -------------------------------------------------------------------------------- /readthedocs.yml: -------------------------------------------------------------------------------- 1 | formats: 2 | - none 3 | requirements_file: docs/requirements.txt 4 | -------------------------------------------------------------------------------- /scala-package/core/scripts/get_cifar_data.sh: -------------------------------------------------------------------------------- 1 | data_path="./data" 2 | if [ ! -d "$data_path" ]; then 3 | mkdir -p "$data_path" 4 | fi 5 | 6 | cifar_data_path="./data/cifar10.zip" 7 | if [ ! -f "$cifar_data_path" ]; then 8 | wget http://data.mxnet.io/mxnet/data/cifar10.zip -P $data_path 9 | cd $data_path 10 | unzip -u cifar10.zip 11 | fi 12 | -------------------------------------------------------------------------------- /scala-package/core/scripts/get_mnist_data.sh: -------------------------------------------------------------------------------- 1 | data_path="./data" 2 | if [ ! -d "$data_path" ]; then 3 | mkdir -p "$data_path" 4 | fi 5 | 6 | mnist_data_path="./data/mnist.zip" 7 | if [ ! -f "$mnist_data_path" ]; then 8 | wget http://data.mxnet.io/mxnet/data/mnist.zip -P $data_path 9 | cd $data_path 10 | unzip -u mnist.zip 11 | fi 12 | -------------------------------------------------------------------------------- /scala-package/core/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # for development debugging 2 | log4j.rootLogger = debug, stdout 3 | 4 | log4j.appender.stdout = org.apache.log4j.ConsoleAppender 5 | log4j.appender.stdout.Target = System.out 6 | log4j.appender.stdout.layout = org.apache.log4j.PatternLayout 7 | log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] [%c] [%p] - %m%n 8 | -------------------------------------------------------------------------------- /scala-package/core/src/test/scala/ml/dmlc/mxnet/AttrScopeSuite.scala: -------------------------------------------------------------------------------- 1 | package ml.dmlc.mxnet 2 | 3 | import org.scalatest.{BeforeAndAfterAll, FunSuite} 4 | 5 | class AttrScopeSuite extends FunSuite with BeforeAndAfterAll { 6 | test("attr basic") { 7 | val (data, gdata) = 8 | AttrScope(Map("group" -> "4", "data" -> "great")).withScope { 9 | val data = Symbol.Variable("data", attr = Map("dtype" -> "data", "group" -> "1")) 10 | val gdata = Symbol.Variable("data2") 11 | (data, gdata) 12 | } 13 | assert(gdata.attr("group").get === "4") 14 | assert(data.attr("group").get === "1") 15 | 16 | val exceedScopeData = Symbol.Variable("data3") 17 | assert(exceedScopeData.attr("group") === None, "No group attr in global attr scope") 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /scala-package/core/src/test/scala/ml/dmlc/mxnet/CheckUtils.scala: -------------------------------------------------------------------------------- 1 | package ml.dmlc.mxnet 2 | 3 | object CheckUtils { 4 | def reldiff(a: NDArray, b: NDArray): Float = { 5 | val diff = NDArray.sum(NDArray.abs(a - b)).toScalar 6 | val norm = NDArray.sum(NDArray.abs(a)).toScalar 7 | diff / norm 8 | } 9 | 10 | def reldiff(a: Array[Float], b: Array[Float]): Float = { 11 | val diff = 12 | (a zip b).map { case (aElem, bElem) => Math.abs(aElem - bElem) }.sum 13 | val norm: Float = a.reduce(Math.abs(_) + Math.abs(_)) 14 | diff / norm 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /scala-package/core/src/test/scala/ml/dmlc/mxnet/ShapeSuite.scala: -------------------------------------------------------------------------------- 1 | package ml.dmlc.mxnet 2 | 3 | import org.scalatest.{BeforeAndAfterAll, FunSuite} 4 | 5 | class ShapeSuite extends FunSuite with BeforeAndAfterAll { 6 | test("to string") { 7 | val s = Shape(1, 2, 3) 8 | assert(s.toString === "(1,2,3)") 9 | } 10 | 11 | test("equals") { 12 | assert(Shape(1, 2, 3) === Shape(1, 2, 3)) 13 | assert(Shape(1, 2) != Shape(1, 2, 3)) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /scala-package/examples/scripts/neuralstyle_end2end/run_test_end2end.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MXNET_ROOT=$(cd "$(dirname $0)/../../../.."; pwd) 4 | CLASS_PATH=$MXNET_ROOT/scala-package/assembly/linux-x86_64-gpu/target/*:$MXNET_ROOT/scala-package/examples/target/*:$MXNET_ROOT/scala-package/examples/target/classes/lib/* 5 | 6 | INPUT_IMG=$1 7 | MODEL_DIR=$2 8 | OUTPUT_DIR=$3 9 | GPU=0 10 | 11 | java -Xmx1024m -cp $CLASS_PATH \ 12 | ml.dmlc.mxnet.examples.neuralstyle.end2end.BoostInference \ 13 | --model-path $MODEL_DIR \ 14 | --input-image $INPUT_IMG \ 15 | --output-path $OUTPUT_DIR \ 16 | --gpu $GPU -------------------------------------------------------------------------------- /scala-package/examples/scripts/neuralstyle_end2end/run_train_end2end.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MXNET_ROOT=$(cd "$(dirname $0)/../../../.."; pwd) 4 | CLASS_PATH=$MXNET_ROOT/scala-package/assembly/linux-x86_64-gpu/target/*:$MXNET_ROOT/scala-package/examples/target/*:$MXNET_ROOT/scala-package/examples/target/classes/lib/* 5 | 6 | # more details please refer to 7 | # https://github.com/Ldpe2G/mxnet/blob/develop/example/neural-style/end_to_end/README.md 8 | TRAIN_DATA_PATH=$1 9 | STYLE_IMG=$2 10 | VGG_MODEL_PATH=$3 11 | SAVE_MODEL_DIR=$4 12 | GPU=0 13 | 14 | java -Xmx1024m -cp $CLASS_PATH \ 15 | ml.dmlc.mxnet.examples.neuralstyle.end2end.BoostTrain \ 16 | --data-path $TRAIN_DATA_PATH \ 17 | --vgg--model-path $VGG_MODEL_PATH \ 18 | --save--model-path $SAVE_MODEL_DIR \ 19 | --style-image $STYLE_IMG \ 20 | --gpu $GPU -------------------------------------------------------------------------------- /scala-package/examples/scripts/rnn/run_test_charrnn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MXNET_ROOT=$(cd "$(dirname $0)/../../../.."; pwd) 4 | CLASS_PATH=$MXNET_ROOT/scala-package/assembly/linux-x86_64-gpu/target/*:$MXNET_ROOT/scala-package/examples/target/*:$MXNET_ROOT/scala-package/examples/target/classes/lib/* 5 | 6 | # you can get the training data file using the following command 7 | # wget http://data.mxnet.io/mxnet/data/lab_data.zip 8 | # unzip -o lab_data.zip 9 | # for example ./datas/obama.txt 10 | DATA_PATH=$1 11 | # for example ./models/obama 12 | MODEL_PREFIX=$2 13 | # feel free to change the starter sentence 14 | STARTER_SENTENCE="The joke" 15 | 16 | java -Xmx4G -cp $CLASS_PATH \ 17 | ml.dmlc.mxnet.examples.rnn.TestCharRnn \ 18 | --data-path $DATA_PATH \ 19 | --model-prefix $MODEL_PREFIX \ 20 | --starter-sentence "$STARTER_SENTENCE" 21 | -------------------------------------------------------------------------------- /scala-package/examples/scripts/rnn/run_train_charrnn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MXNET_ROOT=$(cd "$(dirname $0)/../../../.."; pwd) 4 | CLASS_PATH=$MXNET_ROOT/scala-package/assembly/linux-x86_64-gpu/target/*:$MXNET_ROOT/scala-package/examples/target/*:$MXNET_ROOT/scala-package/examples/target/classes/lib/* 5 | 6 | # which gpu card to use, -1 means cpu 7 | GPU=$1 8 | # you can get the training data file using the following command 9 | # wget http://data.mxnet.io/mxnet/data/lab_data.zip 10 | # unzip -o lab_data.zip 11 | # for example ./datas/obama.txt 12 | DATA_PATH=$2 13 | # for example ./models 14 | SAVE_MODEL_PATH=$3 15 | 16 | java -Xmx4G -cp $CLASS_PATH \ 17 | ml.dmlc.mxnet.examples.rnn.TrainCharRnn \ 18 | --data-path $DATA_PATH \ 19 | --save-model-path $SAVE_MODEL_PATH \ 20 | --gpu $GPU \ 21 | -------------------------------------------------------------------------------- /scala-package/examples/scripts/run_cnntextclassification.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MXNET_ROOT=$(cd "$(dirname $0)/../../.."; pwd) 4 | CLASS_PATH=$MXNET_ROOT/scala-package/assembly/linux-x86_64-gpu/target/*:$MXNET_ROOT/scala-package/examples/target/*:$MXNET_ROOT/scala-package/examples/target/classes/lib/* 5 | 6 | # which gpu card to use, -1 means cpu 7 | GPU=$1 8 | # the mr dataset path, you should put the pos and neg file in the same folder 9 | MR_DATASET_PATH=$2 10 | # the trained word2vec file path, binary or text format 11 | W2V_FILE_PATH=$3 12 | # whether the format of the word2vec file is binary,1 means binary, 0 means text 13 | W2V_FORMAT_BIN=$4 14 | BATCH_SIZE=$5 15 | SAVE_MODEL_PATH=$6 16 | 17 | java -Xmx8G -cp $CLASS_PATH \ 18 | ml.dmlc.mxnet.examples.cnnclassification.CNNTextClassification \ 19 | --gpu $GPU \ 20 | --mr-dataset-path $MR_DATASET_PATH \ 21 | --w2v-file-path $W2V_FILE_PATH \ 22 | --w2v-format-bin $W2V_FORMAT_BIN \ 23 | --batch-size $BATCH_SIZE \ 24 | --save-model-path $SAVE_MODEL_PATH 25 | -------------------------------------------------------------------------------- /scala-package/examples/scripts/run_gan_mnist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MXNET_ROOT=$(cd "$(dirname $0)/../../.."; pwd) 4 | CLASS_PATH=$MXNET_ROOT/scala-package/assembly/linux-x86_64-gpu/target/*:$MXNET_ROOT/scala-package/examples/target/*:$MXNET_ROOT/scala-package/examples/target/classes/lib/* 5 | 6 | # which gpu card to use, -1 means cpu 7 | GPU=$1 8 | 9 | # the mnist data path 10 | # you can get the mnist data using the script core/scripts/get_mnist_data.sh 11 | MNIST_DATA_PATH=$2 12 | 13 | # the path to save the generated results 14 | OUTPUT_PATH=$3 15 | 16 | java -Xmx4G -cp $CLASS_PATH \ 17 | ml.dmlc.mxnet.examples.gan.GanMnist \ 18 | --mnist-data-path $MNIST_DATA_PATH \ 19 | --gpu $GPU \ 20 | --output-path $OUTPUT_PATH 21 | -------------------------------------------------------------------------------- /scala-package/examples/scripts/run_multitask.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MXNET_ROOT=$(cd "$(dirname $0)/../../.."; pwd) 4 | CLASS_PATH=$MXNET_ROOT/scala-package/assembly/linux-x86_64-gpu/target/*:$MXNET_ROOT/scala-package/examples/target/*:$MXNET_ROOT/scala-package/examples/target/classes/lib/* 5 | 6 | # which gpu card to use, -1 means cpu 7 | GPU=$1 8 | 9 | # the mnist data path 10 | # you can get the mnist data using the script core/scripts/get_mnist_data.sh 11 | DATA_PATH=$2 12 | 13 | java -Xmx4G -cp $CLASS_PATH \ 14 | ml.dmlc.mxnet.examples.multitask.ExampleMultiTask \ 15 | --data-path $DATA_PATH \ 16 | --gpu $GPU \ 17 | -------------------------------------------------------------------------------- /scala-package/examples/scripts/run_neuralstyle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MXNET_ROOT=$(cd "$(dirname $0)/../../.."; pwd) 4 | CLASS_PATH=$MXNET_ROOT/scala-package/assembly/linux-x86_64-gpu/target/*:$MXNET_ROOT/scala-package/examples/target/*:$MXNET_ROOT/scala-package/examples/target/classes/lib/* 5 | INPUT_IMG=$1 6 | STYLE_IMG=$2 7 | MODEL_PATH=$MXNET_ROOT/example/neural-style/model/vgg19.params 8 | OUTPUT_DIR=$MXNET_ROOT/example/neural-style/output 9 | 10 | java -Xmx1024m -cp $CLASS_PATH \ 11 | ml.dmlc.mxnet.examples.neuralstyle.NeuralStyle \ 12 | --content-image $INPUT_IMG \ 13 | --style-image $STYLE_IMG \ 14 | --model-path $MODEL_PATH \ 15 | --output-dir $OUTPUT_DIR 16 | -------------------------------------------------------------------------------- /scala-package/examples/scripts/run_visualization.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MXNET_ROOT=$(cd "$(dirname $0)/../../.."; pwd) 4 | CLASS_PATH=$MXNET_ROOT/scala-package/assembly/linux-x86_64-cpu/target/*:$MXNET_ROOT/scala-package/examples/target/*:$MXNET_ROOT/scala-package/examples/target/classes/lib/* 5 | 6 | # please install the Graphviz library 7 | # if you are using ubuntu, use the following command: 8 | # sudo apt-get install graphviz 9 | 10 | # path to save the generated visualization result 11 | OUT_DIR=$1 12 | # net to visualze, e.g. "LeNet", "AlexNet", "VGG", "GoogleNet", "Inception_BN", "Inception_V3", "ResNet_Small" 13 | NET=$2 14 | 15 | java -Xmx1024m -cp $CLASS_PATH \ 16 | ml.dmlc.mxnet.examples.visualization.ExampleVis \ 17 | --out-dir $OUT_DIR \ 18 | --net $NET 19 | -------------------------------------------------------------------------------- /scala-package/examples/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # for development debugging 2 | log4j.rootLogger = info, stdout 3 | 4 | log4j.appender.stdout = org.apache.log4j.ConsoleAppender 5 | log4j.appender.stdout.Target = System.out 6 | log4j.appender.stdout.layout = org.apache.log4j.PatternLayout 7 | log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] [%c] [%p] - %m%n 8 | -------------------------------------------------------------------------------- /scala-package/init/src/main/scala/ml/dmlc/mxnet/init/LibInfo.scala: -------------------------------------------------------------------------------- 1 | package ml.dmlc.mxnet.init 2 | 3 | import ml.dmlc.mxnet.init.Base._ 4 | 5 | import scala.collection.mutable.ListBuffer 6 | 7 | class LibInfo { 8 | @native def mxSymbolListAtomicSymbolCreators(symbolList: ListBuffer[SymbolHandle]): Int 9 | @native def mxSymbolGetAtomicSymbolInfo(handle: SymbolHandle, 10 | name: RefString, 11 | desc: RefString, 12 | numArgs: RefInt, 13 | argNames: ListBuffer[String], 14 | argTypes: ListBuffer[String], 15 | argDescs: ListBuffer[String], 16 | keyVarNumArgs: RefString): Int 17 | } 18 | -------------------------------------------------------------------------------- /scala-package/spark/src/main/scala/ml/dmlc/mxnet/spark/MXNDArray.scala: -------------------------------------------------------------------------------- 1 | package ml.dmlc.mxnet.spark 2 | 3 | import ml.dmlc.mxnet.NDArray 4 | 5 | /** 6 | * A wrapper for serialize & deserialize [[ml.dmlc.mxnet.NDArray]] in spark job 7 | * @author Yizhi Liu 8 | */ 9 | class MXNDArray(@transient private var ndArray: NDArray) extends Serializable { 10 | require(ndArray != null) 11 | private val arrayBytes: Array[Byte] = ndArray.serialize() 12 | 13 | def get: NDArray = { 14 | if (ndArray == null) { 15 | ndArray = NDArray.deserialize(arrayBytes) 16 | } 17 | ndArray 18 | } 19 | } 20 | 21 | object MXNDArray { 22 | def apply(ndArray: NDArray): MXNDArray = new MXNDArray(ndArray) 23 | } 24 | -------------------------------------------------------------------------------- /scala-package/spark/src/main/scala/ml/dmlc/mxnet/spark/io/LongLivingDataBatch.scala: -------------------------------------------------------------------------------- 1 | package ml.dmlc.mxnet.spark.io 2 | 3 | import ml.dmlc.mxnet.{NDArray, DataBatch} 4 | 5 | /** 6 | * Dispose only when 'disposeForce' called 7 | * @author Yizhi Liu 8 | */ 9 | class LongLivingDataBatch( 10 | override val data: IndexedSeq[NDArray], 11 | override val label: IndexedSeq[NDArray], 12 | override val index: IndexedSeq[Long], 13 | override val pad: Int) extends DataBatch(data, label, index, pad) { 14 | override def dispose(): Unit = {} 15 | def disposeForce(): Unit = super.dispose() 16 | } 17 | -------------------------------------------------------------------------------- /src/c_api/c_api_error.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file c_api_error.cc 4 | * \brief C error handling 5 | */ 6 | #include "./c_api_error.h" 7 | #include "../common/thread_local.h" 8 | 9 | struct ErrorEntry { 10 | std::string last_error; 11 | }; 12 | 13 | typedef mxnet::common::ThreadLocalStore MXAPIErrorStore; 14 | 15 | const char *MXGetLastError() { 16 | return MXAPIErrorStore::Get()->last_error.c_str(); 17 | } 18 | 19 | void MXAPISetLastError(const char* msg) { 20 | MXAPIErrorStore::Get()->last_error = msg; 21 | } 22 | -------------------------------------------------------------------------------- /src/initialize.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2016 by Contributors 3 | * \file initialize.cc 4 | * \brief initialize mxnet library 5 | */ 6 | #include 7 | 8 | namespace mxnet { 9 | class LibraryInitializer { 10 | public: 11 | LibraryInitializer() { 12 | dmlc::InitLogging("mxnet"); 13 | } 14 | }; 15 | 16 | static LibraryInitializer __library_init; 17 | } // namespace mxnet 18 | 19 | -------------------------------------------------------------------------------- /src/io/io.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 by Contributors 2 | 3 | #include 4 | #include 5 | #include "./image_augmenter.h" 6 | #include "./iter_normalize.h" 7 | #include "./iter_batchloader.h" 8 | #include "./iter_prefetcher.h" 9 | 10 | // Registers 11 | namespace dmlc { 12 | DMLC_REGISTRY_ENABLE(::mxnet::DataIteratorReg); 13 | } // namespace dmlc 14 | 15 | namespace mxnet { 16 | namespace io { 17 | // Register parameters in header files 18 | DMLC_REGISTER_PARAMETER(BatchParam); 19 | DMLC_REGISTER_PARAMETER(PrefetcherParam); 20 | DMLC_REGISTER_PARAMETER(ImageNormalizeParam); 21 | } // namespace io 22 | } // namespace mxnet 23 | -------------------------------------------------------------------------------- /src/operator/batch_norm.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file batch_norm.cu 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | 8 | #include "./batch_norm-inl.h" 9 | #include "./cudnn_batch_norm-inl.h" 10 | 11 | namespace mxnet { 12 | namespace op { 13 | template<> 14 | Operator *CreateOp(BatchNormParam param, int dtype) { 15 | #if MXNET_USE_CUDNN == 1 && CUDNN_MAJOR >= 5 16 | if (!param.use_global_stats) { 17 | return new CuDNNBatchNormOp(param); 18 | } else { 19 | return new BatchNormOp(param); 20 | } 21 | #else 22 | return new BatchNormOp(param); 23 | #endif 24 | } 25 | 26 | } // namespace op 27 | } // namespace mxnet 28 | 29 | -------------------------------------------------------------------------------- /src/operator/block_grad.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file block_grad.cc 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | #include "./block_grad-inl.h" 8 | 9 | namespace mxnet { 10 | namespace op { 11 | template<> 12 | Operator *CreateOp(int dtype) { 13 | Operator *op = NULL; 14 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 15 | op = new BlockGradientOp(); 16 | }); 17 | return op; 18 | } 19 | 20 | } // namespace op 21 | } // namespace mxnet 22 | 23 | -------------------------------------------------------------------------------- /src/operator/broadcast_mask_op.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file broadcast_mask_op.cc 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | #include "./broadcast_mask_op-inl.h" 8 | 9 | -------------------------------------------------------------------------------- /src/operator/broadcast_mask_op.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file broadcast_mask_op.cu 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | #include "./broadcast_mask_op-inl.h" 8 | 9 | -------------------------------------------------------------------------------- /src/operator/broadcast_reduce_op.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file broadcast_reduce_op.cc 4 | * \brief CPU Implementation of broadcast reduce op 5 | */ 6 | // this will be invoked by gcc and compile CPU version 7 | #include "./broadcast_reduce_op-inl.h" 8 | namespace mxnet { 9 | namespace op { 10 | 11 | DMLC_REGISTER_PARAMETER(ReduceAxisParam); 12 | DMLC_REGISTER_PARAMETER(BroadcastAxisParam); 13 | DMLC_REGISTER_PARAMETER(BroadcastToParam); 14 | 15 | } // namespace op 16 | } // namespace mxnet 17 | -------------------------------------------------------------------------------- /src/operator/broadcast_reduce_op.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file broadcast_reduce_op.cu 4 | * \brief GPU Implementation of broadcast reduce op 5 | */ 6 | // this will be invoked by gcc and compile CPU version 7 | #include "./broadcast_reduce_op-inl.h" 8 | -------------------------------------------------------------------------------- /src/operator/cast.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file cast.cu 4 | * \brief 5 | * \author Junyuan Xie 6 | */ 7 | #include 8 | 9 | #include "./cast-inl.h" 10 | #include "./mshadow_op.h" 11 | 12 | namespace mxnet { 13 | namespace op { 14 | template<> 15 | Operator *CreateOp(CastParam param, std::vector *in_type) { 16 | Operator *op = NULL; 17 | MSHADOW_TYPE_SWITCH((*in_type)[0], SrcDType, { 18 | MSHADOW_TYPE_SWITCH(param.dtype, DstDType, { 19 | op = new CastOp(); 20 | }) 21 | }) 22 | return op; 23 | } 24 | } // namespace op 25 | } // namespace mxnet 26 | 27 | -------------------------------------------------------------------------------- /src/operator/concat.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file concat.cu 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | 8 | #include "./concat-inl.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template<> 13 | Operator* CreateOp(ConcatParam param, int dtype) { 14 | Operator *op = NULL; 15 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 16 | op = new ConcatOp(param); 17 | }); 18 | return op; 19 | } 20 | 21 | } // namespace op 22 | } // namespace mxnet 23 | 24 | -------------------------------------------------------------------------------- /src/operator/crop.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file concat.cu 4 | * \brief 5 | * \author Wei Wu 6 | */ 7 | 8 | #include "./crop-inl.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template<> 13 | Operator* CreateOp(CropParam param) { 14 | return new CropOp(param); 15 | } 16 | 17 | } // namespace op 18 | } // namespace mxnet 19 | -------------------------------------------------------------------------------- /src/operator/cudnn_batch_norm.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file cudnn_batch_norm.cu 4 | * \brief 5 | * \author Junyuan Xie 6 | */ 7 | 8 | #include "./cudnn_batch_norm-inl.h" 9 | #include 10 | 11 | namespace mxnet { 12 | namespace op { 13 | #if CUDNN_MAJOR == 4 14 | template<> 15 | Operator *CreateOp_CuDNNv4(BatchNormParam param) { 16 | return new CuDNNBatchNormOp(param); 17 | } 18 | #endif // CUDNN_MAJOR == 4 19 | } // namespace op 20 | } // namespace mxnet 21 | 22 | -------------------------------------------------------------------------------- /src/operator/deconvolution.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file deconvolution.cu 4 | * \brief 5 | * \author Wei Wu 6 | */ 7 | 8 | #include "./deconvolution-inl.h" 9 | #if MXNET_USE_CUDNN == 1 10 | #include "./cudnn_deconvolution-inl.h" 11 | #endif // MXNET_USE_CUDNN 12 | 13 | namespace mxnet { 14 | namespace op { 15 | template<> 16 | Operator* CreateOp(DeconvolutionParam param, int dtype) { 17 | Operator *op = NULL; 18 | #if MXNET_USE_CUDNN == 1 19 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 20 | op = new CuDNNDeconvolutionOp(param); 21 | }); 22 | #else 23 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 24 | op = new DeconvolutionOp(param); 25 | }); 26 | #endif // MXNET_USE_CUDNN 27 | return op; 28 | } 29 | 30 | } // namespace op 31 | } // namespace mxnet 32 | -------------------------------------------------------------------------------- /src/operator/dropout.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file dropout.cc 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | 8 | #include "./dropout-inl.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template<> 13 | Operator *CreateOp(DropoutParam param, int dtype) { 14 | Operator *op = NULL; 15 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 16 | op = new DropoutOp(param); 17 | }); 18 | return op; 19 | } 20 | } // namespace op 21 | } // namespace mxnet 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/operator/elementwise_binary_broadcast_op.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file elementwise_binary_broadcast_op.cc 4 | * \brief elementwise binary broadcast operator 5 | */ 6 | #include "./elementwise_binary_broadcast_op-inl.h" 7 | -------------------------------------------------------------------------------- /src/operator/elementwise_binary_broadcast_op.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file elementwise_binary_broadcast_op.cu 4 | * \brief elementwise binary broadcast operator 5 | */ 6 | #include "./elementwise_binary_broadcast_op-inl.h" 7 | -------------------------------------------------------------------------------- /src/operator/elementwise_binary_op.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file elementwise_binary_op.cc 4 | * \brief elementwise binary operator 5 | */ 6 | #include "./elementwise_binary_op-inl.h" 7 | 8 | -------------------------------------------------------------------------------- /src/operator/elementwise_binary_op.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file elementwise_binary_op.cu 4 | * \brief elementwise binary operator 5 | */ 6 | #include "./elementwise_binary_op-inl.h" 7 | -------------------------------------------------------------------------------- /src/operator/elementwise_binary_scalar_op.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file elementwise_binary_scalar_op.cc 4 | * \brief elementwise binary operator 5 | */ 6 | #include "./elementwise_binary_scalar_op-inl.h" 7 | -------------------------------------------------------------------------------- /src/operator/elementwise_binary_scalar_op.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file elementwise_binary_scalar_op.cu 4 | * \brief elementwise binary operator 5 | */ 6 | #include "./elementwise_binary_scalar_op-inl.h" 7 | -------------------------------------------------------------------------------- /src/operator/elementwise_sum.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file elementwise_sum.cu 4 | * \brief elementwise sum operator 5 | */ 6 | #include "./elementwise_sum-inl.h" 7 | namespace mxnet { 8 | namespace op { 9 | template<> 10 | Operator* CreateOp(ElementWiseSumParam param, int dtype) { 11 | Operator *op = NULL; 12 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 13 | op = new ElementWiseSumOp(param); 14 | }); 15 | return op; 16 | } 17 | } // namespace op 18 | } // namespace mxnet 19 | -------------------------------------------------------------------------------- /src/operator/elementwise_unary_op.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file elementwise_unary_op.cc 4 | * \brief CPU Implementation of unary function. 5 | */ 6 | // this will be invoked by gcc and compile CPU version 7 | #include "./elementwise_unary_op-inl.h" 8 | -------------------------------------------------------------------------------- /src/operator/elementwise_unary_op.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file elementwise_unary_op.cc 4 | * \brief GPU Implementation of unary function. 5 | */ 6 | // this will be invoked by gcc and compile CPU version 7 | #include "./elementwise_unary_op-inl.h" 8 | -------------------------------------------------------------------------------- /src/operator/embedding.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file embedding.cu 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | 8 | #include "./embedding-inl.h" 9 | namespace mxnet { 10 | namespace op { 11 | template<> 12 | Operator* CreateOp(EmbeddingParam param, int dtype) { 13 | Operator *op = NULL; 14 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 15 | op = new EmbeddingOp(param); 16 | }); 17 | return op; 18 | } 19 | } // namespace op 20 | } // namespace mxnet 21 | 22 | -------------------------------------------------------------------------------- /src/operator/fully_connected.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file fully_connected.cu 4 | * \brief fully connect operator 5 | */ 6 | #include "./fully_connected-inl.h" 7 | namespace mxnet { 8 | namespace op { 9 | template<> 10 | Operator* CreateOp(FullyConnectedParam param, int dtype) { 11 | Operator *op = NULL; 12 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 13 | op = new FullyConnectedOp(param); 14 | }) 15 | return op; 16 | } 17 | } // namespace op 18 | } // namespace mxnet 19 | -------------------------------------------------------------------------------- /src/operator/identity_attach_KL_sparse_reg.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file identity_attach_KL_sparse_reg.cc 4 | * \brief\ 5 | */ 6 | #include "./identity_attach_KL_sparse_reg-inl.h" 7 | 8 | namespace mxnet { 9 | namespace op { 10 | template<> 11 | Operator *CreateOp(IdentityAttachKLSparseRegParam param) { 12 | return new IdentityAttachKLSparseRegOp(param); 13 | } 14 | 15 | Operator *IdentityAttachKLSparseRegProp::CreateOperator(Context ctx) const { 16 | DO_BIND_DISPATCH(CreateOp, param_); 17 | } 18 | 19 | DMLC_REGISTER_PARAMETER(IdentityAttachKLSparseRegParam); 20 | 21 | MXNET_REGISTER_OP_PROPERTY(IdentityAttachKLSparseReg, IdentityAttachKLSparseRegProp) 22 | .describe("Apply a sparse regularization to the output a sigmoid activation function.") 23 | .add_argument("data", "Symbol", "Input data.") 24 | .add_arguments(IdentityAttachKLSparseRegParam::__FIELDS__()); 25 | 26 | 27 | } // namespace op 28 | } // namespace mxnet 29 | 30 | -------------------------------------------------------------------------------- /src/operator/identity_attach_KL_sparse_reg.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file identity_attach_KL_sparse_reg.cu 4 | * \brief 5 | */ 6 | #include "./identity_attach_KL_sparse_reg-inl.h" 7 | 8 | namespace mxnet { 9 | namespace op { 10 | template<> 11 | Operator *CreateOp(IdentityAttachKLSparseRegParam param) { 12 | return new IdentityAttachKLSparseRegOp(param); 13 | } 14 | 15 | } // namespace op 16 | } // namespace mxnet 17 | -------------------------------------------------------------------------------- /src/operator/instance_norm.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file instance_norm.cu 4 | * \brief 5 | * \author Sebastian Bodenstein 6 | */ 7 | 8 | #include "./instance_norm-inl.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template <> 13 | Operator* CreateOp(InstanceNormParam param, int dtype) { 14 | return new InstanceNormOp(param); 15 | } 16 | 17 | } // namespace op 18 | } // namespace mxnet 19 | -------------------------------------------------------------------------------- /src/operator/l2_normalization.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file l2_normalization.cc 4 | * \brief l2 normalization operator 5 | */ 6 | #include "./l2_normalization-inl.h" 7 | namespace mxnet { 8 | namespace op { 9 | template<> 10 | Operator* CreateOp(L2NormalizationParam param) { 11 | return new L2NormalizationOp(param); 12 | } 13 | 14 | // DO_BIND_DISPATCH comes from static_operator_common.h 15 | Operator* L2NormalizationProp::CreateOperator(Context ctx) const { 16 | DO_BIND_DISPATCH(CreateOp, param_); 17 | } 18 | 19 | DMLC_REGISTER_PARAMETER(L2NormalizationParam); 20 | 21 | MXNET_REGISTER_OP_PROPERTY(L2Normalization, L2NormalizationProp) 22 | .describe("Set the l2 norm of each instance to a constant.") 23 | .add_argument("data", "Symbol", "Input data to the L2NormalizationOp.") 24 | .add_arguments(L2NormalizationParam::__FIELDS__()); 25 | } // namespace op 26 | } // namespace mxnet 27 | -------------------------------------------------------------------------------- /src/operator/l2_normalization.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file l2_normalization.cu 4 | * \brief l2 normalization operator 5 | */ 6 | #include "./l2_normalization-inl.h" 7 | namespace mxnet { 8 | namespace op { 9 | template<> 10 | Operator* CreateOp(L2NormalizationParam param) { 11 | return new L2NormalizationOp(param); 12 | } 13 | } // namespace op 14 | } // namespace mxnet 15 | -------------------------------------------------------------------------------- /src/operator/leaky_relu.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file leaky_relu.cc 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | 8 | #include "./leaky_relu-inl.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template<> 13 | Operator *CreateOp(LeakyReLUParam param) { 14 | return new LeakyReLUOp(param); 15 | } 16 | 17 | Operator *LeakyReLUProp::CreateOperator(Context ctx) const { 18 | DO_BIND_DISPATCH(CreateOp, param_); 19 | } 20 | 21 | DMLC_REGISTER_PARAMETER(LeakyReLUParam); 22 | 23 | MXNET_REGISTER_OP_PROPERTY(LeakyReLU, LeakyReLUProp) 24 | .describe("Apply activation function to input.") 25 | .add_argument("data", "Symbol", "Input data to activation function.") 26 | .add_arguments(LeakyReLUParam::__FIELDS__()); 27 | 28 | } // namespace op 29 | } // namespace mxnet 30 | 31 | -------------------------------------------------------------------------------- /src/operator/leaky_relu.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file leaky_relu.cc 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | 8 | #include "./leaky_relu-inl.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template<> 13 | Operator *CreateOp(LeakyReLUParam param) { 14 | return new LeakyReLUOp(param); 15 | } 16 | 17 | } // namespace op 18 | } // namespace mxnet 19 | 20 | -------------------------------------------------------------------------------- /src/operator/loss_binary_op.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file loss_binary_op.cc 4 | * \brief loss function that takes a data and label 5 | */ 6 | #include "./loss_binary_op-inl.h" 7 | -------------------------------------------------------------------------------- /src/operator/loss_binary_op.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file loss_binary_op.cu 4 | * \brief loss function that takes a data and label 5 | */ 6 | #include "./loss_binary_op-inl.h" 7 | -------------------------------------------------------------------------------- /src/operator/lrn.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file lrn.cu 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | 8 | #include "./lrn-inl.h" 9 | #if MXNET_USE_CUDNN == 1 10 | #include "./cudnn_lrn-inl.h" 11 | #endif 12 | 13 | namespace mxnet { 14 | namespace op { 15 | template<> 16 | Operator* CreateOp(LRNParam param, int dtype) { 17 | #if MXNET_USE_CUDNN == 1 18 | return new CuDNNLocalResponseNormOp(param); 19 | #else 20 | #if CUDA_VERSION == 7000 21 | LOG(FATAL) << "Due to old CUDA compiler bug, LRN is disabled." 22 | << "Please upgrade CUDA to 7.5+ or use CUDNN"; 23 | return NULL; 24 | #else 25 | return new LocalResponseNormOp(param); 26 | #endif // CUDA_VERSION 27 | #endif // MXNET_USE_CUDNN 28 | } 29 | 30 | } // namespace op 31 | } // namespace mxnet 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/operator/make_loss.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file make_loss.cu 4 | * \brief special layer for propagating loss 5 | */ 6 | #include "./make_loss-inl.h" 7 | 8 | namespace mxnet { 9 | namespace op { 10 | template<> 11 | Operator *CreateOp(MakeLossParam param, int dtype) { 12 | Operator *op = NULL; 13 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 14 | op = new MakeLossOp(param); 15 | }); 16 | return op; 17 | } 18 | 19 | } // namespace op 20 | } // namespace mxnet 21 | 22 | -------------------------------------------------------------------------------- /src/operator/matrix_op.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file matrix_op.cc 4 | * \brief CPU Implementation of matrix operations 5 | */ 6 | // this will be invoked by gcc and compile CPU version 7 | #include "./matrix_op-inl.h" 8 | 9 | namespace mxnet { 10 | namespace op { 11 | DMLC_REGISTER_PARAMETER(TransposeParam); 12 | DMLC_REGISTER_PARAMETER(ExpandDimParam); 13 | DMLC_REGISTER_PARAMETER(SimpleCropParam); 14 | DMLC_REGISTER_PARAMETER(SimpleCropAssignScalarParam); 15 | DMLC_REGISTER_PARAMETER(SliceParam); 16 | DMLC_REGISTER_PARAMETER(FlipParam); 17 | } // op 18 | } // mxnet 19 | -------------------------------------------------------------------------------- /src/operator/matrix_op.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file matrix_op.cu 4 | * \brief GPU Implementation of matrix operations 5 | */ 6 | // this will be invoked by gcc and compile GPU version 7 | #include "./matrix_op-inl.h" 8 | -------------------------------------------------------------------------------- /src/operator/native_op.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file native_op.cc 4 | * \brief 5 | * \author Junyuan Xie 6 | */ 7 | #include "./native_op-inl.h" 8 | 9 | namespace mxnet { 10 | namespace op { 11 | template<> 12 | Operator *CreateOp(NativeOpParam param) { 13 | return new NativeOp(param); 14 | } 15 | 16 | Operator* NativeOpProp::CreateOperator(Context ctx) const { 17 | DO_BIND_DISPATCH(CreateOp, param_); 18 | } 19 | 20 | DMLC_REGISTER_PARAMETER(NativeOpParam); 21 | 22 | MXNET_REGISTER_OP_PROPERTY(_Native, NativeOpProp) 23 | .describe("Stub for implementing an operator implemented in native frontend language.") 24 | .add_arguments(NativeOpParam::__FIELDS__()); 25 | 26 | } // namespace op 27 | } // namespace mxnet 28 | -------------------------------------------------------------------------------- /src/operator/native_op.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file native_op.cu 4 | * \brief 5 | * \author Junyuan Xie 6 | */ 7 | #include "./native_op-inl.h" 8 | namespace mxnet { 9 | namespace op { 10 | template<> 11 | Operator* CreateOp(NativeOpParam param) { 12 | return new NativeOp(param); 13 | } 14 | } // namespace op 15 | } // namespace mxnet 16 | -------------------------------------------------------------------------------- /src/operator/operator.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file operator.cc 4 | * \brief operator module of mxnet 5 | */ 6 | #include 7 | #include 8 | #include 9 | 10 | namespace dmlc { 11 | DMLC_REGISTRY_ENABLE(::mxnet::OperatorPropertyReg); 12 | } // namespace dmlc 13 | 14 | namespace mxnet { 15 | // implementation of all factory functions 16 | OperatorProperty *OperatorProperty::Create(const char* type_name) { 17 | auto *creator = dmlc::Registry::Find(type_name); 18 | if (creator == nullptr) { 19 | LOG(FATAL) << "Cannot find Operator " << type_name << " in registry"; 20 | } 21 | return creator->body(); 22 | } 23 | } // namespace mxnet 24 | -------------------------------------------------------------------------------- /src/operator/reshape.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file flatten.cc 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | 8 | #include "./reshape-inl.h" 9 | 10 | 11 | namespace mxnet { 12 | namespace op { 13 | template<> 14 | Operator *CreateOp(ReshapeParam param, int dtype) { 15 | Operator *op = NULL; 16 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 17 | op = new ReshapeOp(param); 18 | }); 19 | return op; 20 | } 21 | 22 | } // namespace op 23 | } // namespace mxnet 24 | -------------------------------------------------------------------------------- /src/operator/rnn.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file rnn.cu 4 | * \brief 5 | * \author Sebastian Bodenstein 6 | */ 7 | 8 | #include "./rnn-inl.h" 9 | #include 10 | #if MXNET_USE_CUDNN == 1 && CUDNN_MAJOR == 5 11 | #include "./cudnn_rnn-inl.h" 12 | #endif // MXNET_USE_CUDNN && CUDNN_MAJOR 13 | 14 | namespace mxnet { 15 | namespace op { 16 | template<> 17 | Operator* CreateOp(RNNParam param, int dtype) { 18 | Operator *op = NULL; 19 | #if MXNET_USE_CUDNN == 1 && CUDNN_MAJOR == 5 20 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 21 | op = new CuDNNRNNOp(param); 22 | }) 23 | #else 24 | LOG(FATAL) << "RNN is only available for cuDNN at the moment."; 25 | #endif // MXNET_USE_CUDNN && CUDNN_MAJOR 26 | return op; 27 | } 28 | 29 | } // namespace op 30 | } // namespace mxnet 31 | -------------------------------------------------------------------------------- /src/operator/sample_op.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2016 by Contributors 3 | * \file sample_op.cc 4 | * \brief CPU Implementation of sample op 5 | */ 6 | // this will be invoked by cc 7 | #include "./sample_op-inl.h" 8 | 9 | namespace mxnet { 10 | namespace op { 11 | 12 | DMLC_REGISTER_PARAMETER(SampleUniformParam); 13 | DMLC_REGISTER_PARAMETER(SampleNormalParam); 14 | 15 | } // namespace op 16 | } // namespace mxnet 17 | -------------------------------------------------------------------------------- /src/operator/sample_op.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2016 by Contributors 3 | * \file sample_op.cu 4 | * \brief GPU Implementation of sample op 5 | */ 6 | // this will be invoked by nvcc and compile GPU version 7 | #include "./sample_op-inl.h" 8 | -------------------------------------------------------------------------------- /src/operator/sequence_last.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file sequence_last.cu 4 | * \brief 5 | * \author Sebastian Bodenstein 6 | */ 7 | 8 | #include "./sequence_last-inl.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template <> Operator *CreateOp(SequenceLastParam param, int dtype) { 13 | Operator *op = NULL; 14 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, 15 | { op = new SequenceLastOp(param); }) 16 | return op; 17 | } 18 | 19 | } // namespace op 20 | } // namespace mxnet 21 | -------------------------------------------------------------------------------- /src/operator/sequence_reverse.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file sequence_reverse.cu 4 | * \brief 5 | * \author Sebastian Bodenstein 6 | */ 7 | 8 | #include "./sequence_reverse-inl.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template <> Operator *CreateOp(SequenceReverseParam param, int dtype) { 13 | Operator *op = NULL; 14 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 15 | op = new SequenceReverseOp(param); 16 | }) 17 | return op; 18 | } 19 | 20 | } // namespace op 21 | } // namespace mxnet 22 | -------------------------------------------------------------------------------- /src/operator/slice_channel.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file slice_channel.cc 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | 8 | #include "./slice_channel-inl.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template<> 13 | Operator* CreateOp(SliceChannelParam param) { 14 | return new SliceChannelOp(param); 15 | } 16 | 17 | Operator* SliceChannelProp::CreateOperator(Context ctx) const { 18 | DO_BIND_DISPATCH(CreateOp, param_); 19 | } 20 | 21 | DMLC_REGISTER_PARAMETER(SliceChannelParam); 22 | 23 | MXNET_REGISTER_OP_PROPERTY(SliceChannel, SliceChannelProp) 24 | .describe("Slice input equally along specified axis") 25 | .set_return_type("Symbol[]") 26 | .add_arguments(SliceChannelParam::__FIELDS__()); 27 | 28 | } // namespace op 29 | } // namespace mxnet 30 | 31 | -------------------------------------------------------------------------------- /src/operator/slice_channel.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file slice_channel.cc 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | 8 | #include "./slice_channel-inl.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template<> 13 | Operator* CreateOp(SliceChannelParam param) { 14 | return new SliceChannelOp(param); 15 | } 16 | 17 | } // namespace op 18 | } // namespace mxnet 19 | 20 | -------------------------------------------------------------------------------- /src/operator/smooth_l1_unary.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file smooth_l1_unary.cc 4 | * \brief Smooth L1 loss 5 | */ 6 | #include "./smooth_l1_unary-inl.h" 7 | -------------------------------------------------------------------------------- /src/operator/smooth_l1_unary.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file smooth_l1.cu 4 | * \brief Smooth L1 loss 5 | */ 6 | #include "./smooth_l1_unary-inl.h" 7 | -------------------------------------------------------------------------------- /src/operator/softmax_activation.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file softmax_activation.cu 4 | * \brief 5 | * \author Junyuan Xie 6 | */ 7 | #include "./softmax_activation-inl.h" 8 | #include "./mshadow_op.h" 9 | #if MXNET_USE_CUDNN == 1 10 | #include "./cudnn_softmax_activation-inl.h" 11 | #endif 12 | 13 | namespace mxnet { 14 | namespace op { 15 | template<> 16 | Operator *CreateOp(SoftmaxActivationParam param) { 17 | #if MXNET_USE_CUDNN == 1 18 | return new CuDNNSoftmaxActivationOp(param); 19 | #else 20 | return new SoftmaxActivationOp(param); 21 | #endif // MXNET_USE_CUDNN 22 | } 23 | } // namespace op 24 | } // namespace mxnet 25 | 26 | -------------------------------------------------------------------------------- /src/operator/softmax_output.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file softmax_output.cu 4 | * \brief 5 | * \author Bing Xu 6 | */ 7 | 8 | #include "./softmax_output-inl.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | template<> 13 | Operator *CreateOp(SoftmaxOutputParam param, int dtype) { 14 | Operator *op = NULL; 15 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 16 | op = new SoftmaxOutputOp(param); 17 | }) 18 | return op; 19 | } 20 | 21 | } // namespace op 22 | } // namespace mxnet 23 | 24 | -------------------------------------------------------------------------------- /src/operator/swapaxis.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file swapaxis.cu 4 | * \brief 5 | * \author Ming Zhang 6 | */ 7 | 8 | #include "./swapaxis-inl.h" 9 | 10 | namespace mxnet { 11 | namespace op { 12 | 13 | template<> 14 | Operator *CreateOp(SwapAxisParam param, int dtype) { 15 | Operator *op = NULL; 16 | MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { 17 | op = new SwapAxisOp(param); 18 | }); 19 | return op; 20 | } 21 | 22 | } // namespace op 23 | } // namespace mxnet 24 | 25 | -------------------------------------------------------------------------------- /src/optimizer/optimizer.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file optimizer.cc 4 | * \brief optimizer module of mxnet 5 | * \author Junyuan Xie 6 | */ 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace dmlc { 13 | DMLC_REGISTRY_ENABLE(::mxnet::OptimizerReg); 14 | } // namespace dmlc 15 | 16 | namespace mxnet { 17 | // implementation of all factory functions 18 | Optimizer *Optimizer::Create(const char* type_name) { 19 | auto *creator = dmlc::Registry::Find(type_name); 20 | if (creator == nullptr) { 21 | LOG(FATAL) << "Cannot find Optimizer " << type_name << " in registry"; 22 | } 23 | return creator->body(); 24 | } 25 | } // namespace mxnet 26 | -------------------------------------------------------------------------------- /src/optimizer/sgd.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file sgd.cc 4 | * \brief sgd optimizer 5 | */ 6 | #include 7 | #include "./sgd-inl.h" 8 | 9 | 10 | namespace mxnet { 11 | namespace opt { 12 | 13 | void call_sgd_mom_update_cpu(RunContext ctx, TBlob weight, const TBlob grad, TBlob mom, 14 | float lr, float wd, const SGDParam& param) { 15 | sgd_mom_update(ctx, weight, grad, mom, lr, wd, param); 16 | } 17 | void call_sgd_update_cpu(RunContext ctx, TBlob weight, const TBlob grad, 18 | float lr, float wd, const SGDParam& param) { 19 | sgd_update(ctx, weight, grad, lr, wd, param); 20 | } 21 | 22 | DMLC_REGISTER_PARAMETER(SGDParam); 23 | 24 | MXNET_REGISTER_OPTIMIZER(ccsgd, SGDOpt) 25 | .describe("Stochastic gradient decent optimizer implemented in C++."); 26 | 27 | } // namespace opt 28 | } // namespace mxnet 29 | -------------------------------------------------------------------------------- /src/optimizer/sgd.cu: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright (c) 2015 by Contributors 3 | * \file sgd.cc 4 | * \brief sgd optimizer 5 | */ 6 | #include "./sgd-inl.h" 7 | 8 | namespace mxnet { 9 | namespace opt { 10 | 11 | void call_sgd_mom_update_gpu(RunContext ctx, TBlob weight, const TBlob grad, TBlob mom, 12 | float lr, float wd, const SGDParam& param) { 13 | sgd_mom_update(ctx, weight, grad, mom, lr, wd, param); 14 | } 15 | void call_sgd_update_gpu(RunContext ctx, TBlob weight, const TBlob grad, 16 | float lr, float wd, const SGDParam& param) { 17 | sgd_update(ctx, weight, grad, lr, wd, param); 18 | } 19 | 20 | } // namespace opt 21 | } // namespace mxnet 22 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | *_test 2 | *_unittest 3 | -------------------------------------------------------------------------------- /tests/cpp/.gitignore: -------------------------------------------------------------------------------- 1 | unittest 2 | -------------------------------------------------------------------------------- /tests/cpp/unittest.mk: -------------------------------------------------------------------------------- 1 | TEST_SRC = $(wildcard tests/cpp/*_test.cc) 2 | TEST = $(patsubst tests/cpp/%_test.cc, tests/cpp/%_test, $(TEST_SRC)) 3 | 4 | GTEST_LIB=$(GTEST_PATH)/lib/ 5 | GTEST_INC=$(GTEST_PATH)/include/ 6 | 7 | tests/cpp/% : tests/cpp/%.cc lib/libmxnet.a 8 | $(CXX) -std=c++0x $(CFLAGS) -MM -MT tests/cpp/$* $< >tests/cpp/$*.d 9 | $(CXX) -std=c++0x $(CFLAGS) -I$(GTEST_INC) -o $@ $(filter %.cc %.a, $^) $(LDFLAGS) -L$(GTEST_LIB) -lgtest 10 | 11 | -include tests/cpp/*.d 12 | -------------------------------------------------------------------------------- /tests/jenkins/format: -------------------------------------------------------------------------------- 1 | # match line starting with 'error ', case-insensitive 2 | error /(?i)^error / 3 | 4 | # list of warnings here... 5 | warning /[Ww]arning/ 6 | warning /WARNING/ 7 | 8 | # create a quick access link to lines in the report containing 'INFO' 9 | info /INFO/ 10 | 11 | # each line containing 'BUILD' represents the start of a section for grouping errors and warnings found after the line. 12 | # also creates a quick access link. 13 | start /BUILD/ 14 | -------------------------------------------------------------------------------- /tests/nightly/.gitignore: -------------------------------------------------------------------------------- 1 | data/ 2 | results/ 3 | -------------------------------------------------------------------------------- /tests/nightly/README.md: -------------------------------------------------------------------------------- 1 | # Nightly build for mxnet 2 | 3 | This fold contains scripts to test some heavy jobs, often training with multiple 4 | GPUs, to ensure everything is right. Normally it runs everyday. 5 | The current build server is equipped with Intel i7-4790 and 4 Nvidia GTX 6 | 970 Tis. The build status is available at [ci.dmlc.ml](http://ci.dmlc.ml). We 7 | thank [Dave Andersen](http://www.cs.cmu.edu/~dga) for providing the build machine. 8 | 9 | ## How to use 10 | 11 | ### Run locallly 12 | 13 | Run `tests/nightly/test_all.sh 4` if there are 4 GPUs. 14 | 15 | ### Run on Jenkins 16 | 17 | First merge codes into the master branch, then go to 18 | http://ci.dmlc.ml/job/mxnet/, click **Build Now**. 19 | -------------------------------------------------------------------------------- /tests/nightly/download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dmlc_download() { 4 | url=http://data.mxnet.io/mxnet/datasets/ 5 | dir=$1 6 | file=$2 7 | if [ ! -e data/${dir}/$file ]; then 8 | wget ${url}/${dir}/${file} -P data/${dir}/ || exit -1 9 | else 10 | echo "data/${dir}/$file already exits" 11 | fi 12 | } 13 | 14 | dmlc_download mnist t10k-images-idx3-ubyte 15 | dmlc_download mnist t10k-labels-idx1-ubyte 16 | dmlc_download mnist train-images-idx3-ubyte 17 | dmlc_download mnist train-labels-idx1-ubyte 18 | 19 | dmlc_download cifar10 train.rec 20 | dmlc_download cifar10 test.rec 21 | -------------------------------------------------------------------------------- /tests/python/README.md: -------------------------------------------------------------------------------- 1 | Python Test Case 2 | ================ 3 | This folder contains test cases for mxnet in python. 4 | 5 | * [common](common) contains common utils for all test modules. 6 | - From subfolders, import with ```from ..common import get_data``` 7 | * [unittest](unittest) contains unit test component for each modules. 8 | - These are basic tests that must pass for every commit. 9 | * [train](train) contains tests that runs on real network training. 10 | - These tests can be time consuming. 11 | -------------------------------------------------------------------------------- /tests/python/gpu/test_rtc.py: -------------------------------------------------------------------------------- 1 | # pylint: skip-file 2 | import mxnet as mx 3 | import numpy as np 4 | from numpy.testing import assert_allclose 5 | 6 | if __name__ == '__main__': 7 | x = mx.nd.zeros((10,), ctx=mx.gpu(0)) 8 | x[:] = 1 9 | y = mx.nd.zeros((10,), ctx=mx.gpu(0)) 10 | y[:] = 2 11 | rtc = mx.rtc('abc', [('x', x)], [('y', y)], """ 12 | __shared__ float s_rec[10]; 13 | s_rec[threadIdx.x] = x[threadIdx.x]; 14 | y[threadIdx.x] = expf(s_rec[threadIdx.x]*5.0);""") 15 | rtc.push([x], [y], (1, 1, 1), (10,1,1)) 16 | assert_allclose(y.asnumpy(), np.exp(x.asnumpy()*5.0)) -------------------------------------------------------------------------------- /tests/python/train/common.py: -------------------------------------------------------------------------------- 1 | import sys, os 2 | curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) 3 | sys.path.append(os.path.join(curr_path, '../common/')) 4 | 5 | import models 6 | import get_data 7 | -------------------------------------------------------------------------------- /tests/python/unittest/common.py: -------------------------------------------------------------------------------- 1 | import sys, os 2 | curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) 3 | sys.path.append(os.path.join(curr_path, '../common/')) 4 | 5 | import models 6 | import get_data 7 | -------------------------------------------------------------------------------- /tests/travis/r_vignettes.R: -------------------------------------------------------------------------------- 1 | fnames <- list.files("R-package/vignettes/", pattern="*.Rmd") 2 | sapply(fnames, function(x){ 3 | knitr::purl(paste0("R-package/vignettes/", x)) 4 | }) -------------------------------------------------------------------------------- /tests/travis/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if ! tests/travis/is_core_changed.sh 4 | then 5 | exit 0 6 | fi 7 | 8 | if [ ${TRAVIS_OS_NAME} == "osx" ]; then 9 | brew update 10 | brew tap homebrew/science 11 | brew install opencv 12 | brew install python3 13 | brew install fftw 14 | brew install libpng 15 | brew install ImageMagick 16 | if [ ${TASK} == "python_test" ]; then 17 | python -m pip install --user nose numpy 18 | python3 -m pip install --user nose numpy 19 | fi 20 | fi 21 | 22 | if [ ${TASK} == "lint" ]; then 23 | pip install cpplint 'pylint==1.4.4' 'astroid==1.3.6' --user `whoami` 24 | fi 25 | 26 | if [ ${TASK} == "julia" ]; then 27 | mkdir -p ~/julia 28 | curl -s -L --retry 7 "https://s3.amazonaws.com/julialang/bin/linux/x64/${JULIA_VER}/julia-${JULIA_VER}-latest-linux-x86_64.tar.gz" | tar -C ~/julia -x -z --strip-components=1 -f - 29 | export PATH="${PATH}:${HOME}/julia/bin" 30 | julia -e 'versioninfo()' 31 | fi 32 | -------------------------------------------------------------------------------- /tests/travis/travis_after_failure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ${TASK} == "r_test" ]; then 4 | cat mxnet/mxnet.Rcheck/*.log 5 | fi 6 | -------------------------------------------------------------------------------- /tools/accnn/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "conv_params": { 3 | "conv1_1": 5, 4 | "conv1_2": 32, 5 | "conv2_1": 64, 6 | "conv2_2": 64, 7 | "conv3_1": 96, 8 | "conv3_2": 160, 9 | "conv3_3": 192, 10 | "conv4_1": 256, 11 | "conv4_2": 256, 12 | "conv4_3": 320, 13 | "conv5_1": 384, 14 | "conv5_2": 384, 15 | "conv5_3": 384 16 | }, 17 | "fc_params": { 18 | "fc6": 2048, 19 | "fc7": 2048 20 | } 21 | } -------------------------------------------------------------------------------- /tools/bandwidth/.gitignore: -------------------------------------------------------------------------------- 1 | ResNet 2 | -------------------------------------------------------------------------------- /tools/caffe_converter/Makefile: -------------------------------------------------------------------------------- 1 | # find protoc 2 | ifndef PROTOC 3 | DEPS_PROTOC=../../deps/bin/protoc 4 | ifneq ("$(wildcard $(DEPS_PROTOC))","") 5 | PROTOC = $(DEPS_PROTOC) 6 | else 7 | PROTOC = protoc 8 | endif 9 | endif 10 | 11 | all: caffe_parse/caffe_pb2.py 12 | 13 | clean: 14 | rm caffe_parse/caffe_pb2.py* 15 | 16 | caffe_parse/caffe_pb2.py: 17 | $(PROTOC) --python_out=./ ./caffe_parse/caffe.proto 18 | -------------------------------------------------------------------------------- /tools/caffe_converter/caffe_parse/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xlvector/mxnet/a3a928c21ab91b246a5fab7c9ec135f6e616f899/tools/caffe_converter/caffe_parse/__init__.py -------------------------------------------------------------------------------- /tools/caffe_converter/caffe_parse/parse_from_protobuf.py: -------------------------------------------------------------------------------- 1 | from google.protobuf import text_format 2 | import numpy as np 3 | import caffe_pb2 4 | 5 | def parse_caffemodel(filepath): 6 | ''' 7 | parses the trained .caffemodel file 8 | 9 | filepath: /path/to/trained-model.caffemodel 10 | 11 | returns: layers 12 | ''' 13 | f = open(filepath, 'rb') 14 | contents = f.read() 15 | 16 | netparam = caffe_pb2.NetParameter() 17 | netparam.ParseFromString(contents) 18 | 19 | layers = find_layers(netparam) 20 | return layers 21 | 22 | def find_layers(netparam): 23 | if len(netparam.layers) > 0: 24 | return netparam.layers 25 | elif len(netparam.layer) > 0: 26 | return netparam.layer 27 | else: 28 | raise Exception ("Couldn't find layers") 29 | 30 | def main(): 31 | param_dict = parse_caffemodel('xxx.caffemodel') 32 | 33 | if __name__ == '__main__': 34 | main() 35 | -------------------------------------------------------------------------------- /tools/caffe_converter/make_win32.bat: -------------------------------------------------------------------------------- 1 | @protoc --python_out=./ ./caffe_parse/caffe.proto 2 | @echo done. 3 | @pause 4 | -------------------------------------------------------------------------------- /tools/kill-mxnet.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os, sys 4 | 5 | if len(sys.argv) != 2: 6 | print "usage: %s " % sys.argv[0] 7 | sys.exit(1) 8 | 9 | host_file = sys.argv[1] 10 | prog_name = "train_imagenet" 11 | 12 | # Get host IPs 13 | with open(host_file, "r") as f: 14 | hosts = f.read().splitlines() 15 | ssh_cmd = ( 16 | "ssh " 17 | "-o StrictHostKeyChecking=no " 18 | "-o UserKnownHostsFile=/dev/null " 19 | "-o LogLevel=quiet " 20 | ) 21 | kill_cmd = ( 22 | " " 23 | "ps aux |" 24 | "grep -v grep |" 25 | "grep 'python train_imagenet.py' |" 26 | "awk '{print \$2}'|" 27 | "xargs kill" 28 | ) 29 | print kill_cmd 30 | for host in hosts: 31 | cmd = ssh_cmd + host +" \""+ kill_cmd+"\"" 32 | print cmd 33 | os.system(cmd) 34 | 35 | print "Done killing" 36 | --------------------------------------------------------------------------------