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 -
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.
+
+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 + +.
- + diff --git a/latest/contributing.html b/latest/contributing.html index 80348bb9..61d755df 100644 --- a/latest/contributing.html +++ b/latest/contributing.html @@ -126,7 +126,7 @@ Contributing & Help - + diff --git a/latest/examples/logreg.html b/latest/examples/logreg.html index ae23bc64..7724c11c 100644 --- a/latest/examples/logreg.html +++ b/latest/examples/logreg.html @@ -129,7 +129,7 @@ Logistic Regression - + diff --git a/latest/index.html b/latest/index.html index 78fd6aa8..4dd93ef8 100644 --- a/latest/index.html +++ b/latest/index.html @@ -132,7 +132,7 @@ Home - + diff --git a/latest/internals.html b/latest/internals.html index fad5f6f4..35ab7b07 100644 --- a/latest/internals.html +++ b/latest/internals.html @@ -126,7 +126,7 @@ Internals - + diff --git a/latest/models/basics.html b/latest/models/basics.html index aace9489..30501833 100644 --- a/latest/models/basics.html +++ b/latest/models/basics.html @@ -145,7 +145,7 @@ Model Building Basics - + diff --git a/latest/models/debugging.html b/latest/models/debugging.html index 3d814e02..a58aa329 100644 --- a/latest/models/debugging.html +++ b/latest/models/debugging.html @@ -129,7 +129,7 @@ Debugging - + diff --git a/latest/models/recurrent.html b/latest/models/recurrent.html index 5e68807c..e1897837 100644 --- a/latest/models/recurrent.html +++ b/latest/models/recurrent.html @@ -129,7 +129,7 @@ Recurrence - + diff --git a/latest/models/templates.html b/latest/models/templates.html index 46208a1e..2f5d92f0 100644 --- a/latest/models/templates.html +++ b/latest/models/templates.html @@ -145,7 +145,7 @@ Model Templates - + diff --git a/latest/search_index.js b/latest/search_index.js index f08c32a3..37e7261d 100644 --- a/latest/search_index.js +++ b/latest/search_index.js @@ -185,11 +185,27 @@ var documenterSearchIndex = {"docs": [ }, { - "location": "apis/backends.html#Batching-1", + "location": "apis/backends.html#Backends-1", "page": "Backends", - "title": "Batching", + "title": "Backends", "category": "section", - "text": "[WIP]" + "text": "" +}, + +{ + "location": "apis/backends.html#Basic-Usage-1", + "page": "Backends", + "title": "Basic Usage", + "category": "section", + "text": "model = Chain(Affine(10, 20), σ, Affine(20, 15), softmax)\nxs = rand(10)Currently, Flux's pure-Julia backend has no optimisations. This means that callingmodel(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))\nmxmodel(xs) #> [0.0650, 0.0655, ...]\n# or\ntfmodel = tf(model)\ntfmodel(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." +}, + +{ + "location": "apis/backends.html#Native-Integration-1", + "page": "Backends", + "title": "Native Integration", + "category": "section", + "text": "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\nFlux.loadmx()\n\nmxmodel = 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\nFlux.loadtf()\n\nx = placeholder(Float32)\ny = 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." }, {