- 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
推薦閱讀
- Instant Raspberry Pi Gaming
- Mastering Proxmox(Third Edition)
- AWS:Security Best Practices on AWS
- 來吧!帶你玩轉Excel VBA
- PyTorch Deep Learning Hands-On
- Windows內核原理與實現
- Associations and Correlations
- 高維聚類知識發現關鍵技術研究及應用
- 聊天機器人:入門、進階與實戰
- Lightning Fast Animation in Element 3D
- Mastering GitLab 12
- 學練一本通:51單片機應用技術
- C++程序設計基礎(上)
- ZigBee無線通信技術應用開發
- Hands-On SAS for Data Analysis