- 授权协议: Apache
- 开发语言: Python
- 操作系统: 跨平台
- 软件首页: https://github.com/gluon-api/gluon-api/
- 软件文档: https://github.com/gluon-api/gluon-api/
- 官方下载: https://github.com/gluon-api/gluon-api/
软件介绍
Gluon 是微软联合亚马逊推出的一个开源深度学习库,这是一个清晰、简洁、简单但功能强大的深度学习 API,该规范可以提升开发人员学习深度学习的速度,而无需关心所选择的深度学习框架。Gluon API 提供了灵活的接口来简化深度学习原型设计、创建、训练以及部署,而且不会牺牲数据训练的速度。
Gluon 规范已经在 Apache MXNet 中实现,只需要安装最新的 MXNet 即可使用。推荐使用 Python 3.3 或者更新版本。
主要优势包括:
代码简单,易于理解
灵活,命令式结构: 不需要严格定义神经网络模型,而是将训练算法和模型更紧密地结合起来,开发灵活
动态图: Gluon 可以让开发者动态的定义神经网络模型,这意味着他们可以在运行时创建模型、结构,以及使用任何 Python 原生的控制流
高性能: Gluon 所提供的这些优势对底层引擎的训练速度并没有任何影响
示例代码:
import mxnet as mx
from mxnet import gluon, autograd, ndarray
import numpy as np
train_data = mx.gluon.data.DataLoader(mx.gluon.data.vision.MNIST(train=True,
transform=lambda data, label: (data.astype(np.float32)/255, label)),
batch_size=32, shuffle=True)
test_data = mx.gluon.data.DataLoader(mx.gluon.data.vision.MNIST(train=False,
transform=lambda data, label: (data.astype(np.float32)/255, label)),
batch_size=32, shuffle=False)
# First step is to initialize your model
net = gluon.nn.Sequential()
# Then, define your model architecture
with net.name_scope():
net.add(gluon.nn.Dense(128, activation="relu")) # 1st layer - 128 nodes
net.add(gluon.nn.Dense(64, activation="relu")) # 2nd layer – 64 nodes
net.add(gluon.nn.Dense(10)) # Output layer
# We start with random values for all of the model’s parameters from a
# normal distribution with a standard deviation of 0.05
net.collect_params().initialize(mx.init.Normal(sigma=0.05))
# We opt to use softmax cross entropy loss function to measure how well the # model is able to predict the correct answer
softmax_cross_entropy = gluon.loss.SoftmaxCrossEntropyLoss()
# We opt to use the stochastic gradient descent (sgd) training algorithm
# and set the learning rate hyperparameter to .1
trainer = gluon.Trainer(net.collect_params(), 'sgd', {'learning_rate': .1})
epochs = 10
for e in range(epochs):
for i, (data, label) in enumerate(train_data):
data = data.as_in_context(mx.cpu()).reshape((-1, 784))
label = label.as_in_context(mx.cpu())
with autograd.record(): # Start recording the derivatives
output = net(data) # the forward iteration
loss = softmax_cross_entropy(output, label)
loss.backward()
trainer.step(data.shape[0])
# Provide stats on the improvement of the model over each epoch
curr_loss = ndarray.mean(loss).asscalar()
print("Epoch {}. Current Loss: {}.".format(e, curr_loss))
Excel图表之道
刘万祥 / 电子工业出版社 / 2010年4月 / 59.00元
本书介绍作者在实践工作中总结出来的一套“杂志级商务图表沟通方法”,告诉读者如何设计和制作达到杂志级质量的、专业有效的商务图表,作者对诸如《商业周刊》、《经济学人》等全球顶尖商业杂志上的精彩图表案例进行分析,给出其基于Excel的实现方法,包括数据地图、动态图表、仪表板等众多高级图表技巧。 本书提供大量图表模板源文件,包括详细的制作步骤,提供网上下载。提供博客支持。 本书定位于中高级Ex......一起来看看 《Excel图表之道》 这本书的介绍吧!
