官术网_书友最值得收藏!

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
主站蜘蛛池模板: 绥芬河市| 清苑县| 德化县| 剑阁县| 布尔津县| 铁岭县| 拉孜县| 鹰潭市| 台北市| 阿鲁科尔沁旗| 东兴市| 离岛区| 郁南县| 西城区| 金坛市| 清新县| 澄城县| 祁门县| 双柏县| 天水市| 九江县| 德保县| 泸州市| 白朗县| 潼关县| 泰来县| 漳平市| 济阳县| 济源市| 高州市| 巴中市| 中方县| 安宁市| 日喀则市| 上林县| 桐城市| 乌拉特中旗| 城口县| 公安县| 新昌县| 易门县|