- Deep Learning Essentials
- Wei Di Anurag Bhardwaj Jianing Wei
- 212字
- 2021-06-30 19:17:48
MXNet
MXNet is a multi-language machine learning library. It offers two modes of computation:
- Imperative mode: This mode exposes an interface much like regular NumPy like API. For example, to construct a tensor of zeros on both CPU and GPU using MXNet, you use the following code block:
import mxnet as mx tensor_cpu = mx.nd.zeros((100,), ctx=mx.cpu()) tensor_gpu = mx.nd.zeros((100,), ctx=mx.gpu(0))
In the example earlier, MXNet specifies the location where to hold the tensor either in CPU or in a GPU device at location 0. One important distinction with MXNet is that all computations happen lazily instead of instantaneously. This allows MXNet to achieve incredible utilization of the device, unlike any other framework.
- Symbolic mode: This mode exposes a computation graph like TensorFlow. Though the imperative API is quite useful, one of its drawbacks is its rigidity. All computations need to be known beforehand along with pre-defined data structures. Symbolic API aims to remove this limitation by allowing MXNet to work with symbols or variables instead of fixed data types. These symbols can then be compiled or interpreted to be executed as a set of operations as shown follows:
import mxnet as mx x = mx.sym.Variable("X") # represent a symbol. y = mx.sym.Variable("Y") z = (x + y) m = z / 100
推薦閱讀
- GNU-Linux Rapid Embedded Programming
- Windows XP中文版應(yīng)用基礎(chǔ)
- 數(shù)據(jù)挖掘?qū)嵱冒咐治?/a>
- VB語(yǔ)言程序設(shè)計(jì)
- 大數(shù)據(jù)技術(shù)與應(yīng)用
- Visual Basic.NET程序設(shè)計(jì)
- 基于企業(yè)網(wǎng)站的顧客感知服務(wù)質(zhì)量評(píng)價(jià)理論模型與實(shí)證研究
- 從零開(kāi)始學(xué)PHP
- Linux內(nèi)核精析
- C++程序設(shè)計(jì)基礎(chǔ)(上)
- 基于Proteus的單片機(jī)應(yīng)用技術(shù)
- Natural Language Processing and Computational Linguistics
- 網(wǎng)絡(luò)安全概論
- 工業(yè)機(jī)器人應(yīng)用系統(tǒng)三維建模
- 新世紀(jì)Photoshop CS6中文版應(yīng)用教程