- 授权协议: 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))
渐进增强的Web设计
[美] Todd Parker、[英] Patty Toland、[英] Scott Jehl、[法] Maggie Costello Wachs / 牛化成 / 人民邮电出版社 / 2014-1 / 69.00
本书由全球著名Web设计公司Filament集团两位创始人和两位开发主力联手打造,其中Scott Jehl还是jQuery团队成员。四位作者具有多年的网站设计和开发经验,曾为网站、无线设备、Web应用设计过众多高度实用的用户界面,受到了高度赞扬。本书展示了如何利用渐进增强方法开发网站,从而获得最佳用户体验。本书既是理解渐进增强原则和益处的实用指南,也用详细的案例分析,目的是向设计师以及开发人员传授......一起来看看 《渐进增强的Web设计》 这本书的介绍吧!
