Skip to content

LuxDL Docs

Elegant & Performant Scientific Machine Learning in JuliaLang

A Pure Julia Deep Learning Framework designed for Scientific Machine Learning

Lux.jl

How to Install Lux.jl? โ€‹

Its easy to install Lux.jl. Since Lux.jl is registered in the Julia General registry, you can simply run the following command in the Julia REPL:

julia
julia> using Pkg
julia> Pkg.add("Lux")

If you want to use the latest unreleased version of Lux.jl, you can run the following command: (in most cases the released version will be same as the version on github)

julia
julia> using Pkg
julia> Pkg.add(url="https://github.com/LuxDL/Lux.jl")

Want GPU Support? โ€‹

Install the following package(s):

julia
using Pkg
Pkg.add("LuxCUDA")
# or
Pkg.add(["CUDA", "cuDNN"])
julia
using Pkg
Pkg.add("AMDGPU")
julia
using Pkg
Pkg.add("Metal")
julia
using Pkg
Pkg.add("oneAPI")

Run the following to access a device:

julia
using Lux, LuxCUDA

const dev = gpu_device()
julia
using Lux, AMDGPU

const dev = gpu_device()
julia
using Lux, Metal

const dev = gpu_device()
julia
using Lux, oneAPI

const dev = gpu_device()

Want Reactant (XLA) Support? โ€‹

Install the following package:

julia
using Pkg;
Pkg.add("Reactant")

Run the following to access a device (Reactant automatically selects the best backend by default):

julia
using Reactant, Lux
Reactant.set_default_backend("cpu")

const dev = reactant_device()
julia
using Reactant, Lux
Reactant.set_default_backend("gpu")

const dev = reactant_device()
julia
using Reactant, Lux
Reactant.set_default_backend("tpu")

const dev = reactant_device()