From b2700920bc86a6cdddd963ffd9cc711705ff0de9 Mon Sep 17 00:00:00 2001 From: autodocs Date: Tue, 21 Feb 2017 18:33:28 +0000 Subject: [PATCH] build based on 8c1affd --- latest/apis/backends.html | 83 +++++++++++++++++++++++++++++++++--- latest/apis/batching.html | 2 +- latest/contributing.html | 2 +- latest/examples/logreg.html | 2 +- latest/index.html | 2 +- latest/internals.html | 2 +- latest/models/basics.html | 2 +- latest/models/debugging.html | 2 +- latest/models/recurrent.html | 2 +- latest/models/templates.html | 2 +- latest/search_index.js | 22 ++++++++-- 11 files changed, 106 insertions(+), 17 deletions(-) diff --git a/latest/apis/backends.html b/latest/apis/backends.html index 04602266..df891086 100644 --- a/latest/apis/backends.html +++ b/latest/apis/backends.html @@ -88,7 +88,18 @@ Batching Backends - + @@ -129,7 +140,7 @@ Backends - + @@ -139,12 +150,74 @@ Backends

- -Batching + +Backends

+

+ +Basic Usage + +

+
model = Chain(Affine(10, 20), σ, Affine(20, 15), softmax)
+xs = rand(10)

-[WIP] +Currently, Flux's pure-Julia backend has no optimisations. This means that calling +

+
model(rand(10)) #> [0.0650, 0.0655, ...]
+

+directly won't have great performance. In order to support a computationally intensive training process, we really on a backend like MXNet or TensorFlow. +

+

+This is easy to do. Just call either +mxnet + or +tf + on a model to convert it to a model of that kind: +

+
mxmodel = mxnet(model, (10, 1))
+mxmodel(xs) #> [0.0650, 0.0655, ...]
+# or
+tfmodel = tf(model)
+tfmodel(xs) #> [0.0650, 0.0655, ...]
+

+These new models look and feel exactly like every other model in Flux, including returning the same result when you call them, and can be trained as usual using +Flux.train!() +. The difference is that the computation is being carried out by a backend, which will usually give a large speedup. +

+

+ +Native Integration + +

+

+Flux aims to provide high-level APIs that work well across backends, but in some cases you may want to take advantage of features specific to a given backend. In these cases it's easy to "drop down" and use the backend's API directly, where appropriate. For example: +

+
using MXNet
+Flux.loadmx()
+
+mxmodel = mx.FeedForward(model)
+

+This returns a standard +mx.FeedForward + instance, just like you might have created using MXNet's usual API. You can then use this with MXNet's data provider implementation, custom optimisers, or distributed training processes. +

+

+Same goes for TensorFlow, where it's easy to create a +Tensor + object: +

+
using TensorFlow
+Flux.loadtf()
+
+x  = placeholder(Float32)
+y = Tensor(model, x)
+

+This makes makes it easy to take advantage of Flux's model description and debugging tools while also getting the benefit of the work put into these backends. You can check out how this looks with the integration examples + +here + +.