Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 1.47 KB

README.md

File metadata and controls

42 lines (31 loc) · 1.47 KB

Флукс

Build Status Join the chat at https://gitter.im/FluxML Slack

Flux is an unusually elegant machine learning library. It provides lightweight abstractions on top of Julia's native GPU and AD support, while remaining fully hackable (right down to the GPU kernels).

Define a simple model using any Julia code:

using Flux.Tracker
x, y = rand(10), rand(5) # Dummy input / output
# `track` defines parameters that we can train
W, b = track(randn(5,10)), track(randn(5))
# Transform `x` and calculate the mean squared error
loss = Flux.mse(W*x .+ b, y)
# Calculate and store gradients of `track`ed parameters
back!(loss)
Tracker.grad(W) # Get the gradient of `W` wrt the loss

Define a larger model using high-level abstractions:

using Flux

m = Chain(
  Dense(10, 32, relu),
  Dense(32, 10), softmax)

m(rand(10))

Mix and match the two:

using Flux.Tracker
x, y = rand(10), rand(5)
d = Dense(10, 5)
loss = Flux.mse(d(x), y)

See the documentation or the model zoo for more examples.