MXNet - Scala API¶
MXNet supports the Scala programming language. The MXNet Scala package brings flexible and efficient GPU computing and state-of-art deep learning to Scala. It enables you to write seamless tensor/matrix computation with multiple GPUs in Scala. It also lets you construct and customize the state-of-art deep learning models in Scala, and apply them to tasks, such as image classification and data science challenges.
See the MXNet Scala API Documentation for detailed API information.
Image Classification with the Scala Infer API¶
The Infer API can be used for single and batch image classification. More information can be found at the following locations:
Tensor and Matrix Computations¶
You can perform tensor or matrix computation in pure Scala:
import org.apache.mxnet._ val arr = NDArray.ones(2, 3) // arr: org.apache.mxnet.NDArray = org.apache.mxnet.NDArray@f5e74790 arr.shape // org.apache.mxnet.Shape = (2,3) (arr * 2).toArray // Array[Float] = Array(2.0, 2.0, 2.0, 2.0, 2.0, 2.0) (arr * 2).shape // org.apache.mxnet.Shape = (2,3)
Scala API Tutorials¶
- Module API is a flexible high-level interface for training neural networks.
- Symbolic API performs operations on NDArrays to assemble neural networks from layers.
- IO Data Loading API performs parsing and data loading.
- NDArray API performs vector/matrix/tensor operations.
- KVStore API performs multi-GPU and multi-host distributed training.
- Model API is an alternate simple high-level interface for training neural networks. DEPRECATED