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

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
主站蜘蛛池模板: 灵宝市| 乌海市| 浑源县| 宁德市| 温宿县| 伊吾县| 古浪县| 白银市| 阳曲县| 绥滨县| 河南省| 社旗县| 黎川县| 漳浦县| 交口县| 天祝| 迭部县| 普格县| 新丰县| 明水县| 确山县| 怀宁县| 高邑县| 宜良县| 于都县| 罗城| 浪卡子县| 仪陇县| 肇州县| 萨迦县| 聊城市| 永善县| 玉树县| 仙桃市| 库尔勒市| 西贡区| 牡丹江市| 汕头市| 牟定县| 尚义县| 乌鲁木齐市|