Skip to content

Commit 5450203

Browse files
committed
perf: use the permuted formulation
1 parent 2de969f commit 5450203

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

bench/lux.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ train!(args...; kwargs...) = train!(MSELoss(), AutoZygote(), args...; kwargs...)
1111
function train!(loss, backend, model, ps, st, data; epochs=10)
1212
l1 = loss(model, ps, st, first(data))
1313

14-
tstate = Lux.Experimental.TrainState(model, ps, st, Adam(0.01f0))
14+
tstate = Training.TrainState(model, ps, st, Adam(0.01f0))
1515
for _ in 1:epochs, (x, y) in data
16-
_, _, _, tstate = Lux.Experimental.single_train_step!(backend, loss, (x, y), tstate)
16+
_, _, _, tstate = Training.single_train_step!(backend, loss, (x, y), tstate)
1717
end
1818

1919
l2 = loss(model, ps, st, first(data))
@@ -25,14 +25,14 @@ end
2525
n_points = 128
2626
batch_size = 64
2727

28-
x = rand(Float32, 1, n_points, batch_size);
29-
y = rand(Float32, 1, n_points, batch_size);
28+
x = rand(Float32, n_points, 1, batch_size);
29+
y = rand(Float32, n_points, 1, batch_size);
3030
data = [(x, y)];
3131
t_fwd = zeros(5)
3232
t_train = zeros(5)
3333
for i in 1:5
3434
chs = (1, 128, fill(64, i)..., 128, 1)
35-
model = FourierNeuralOperator(gelu; chs=chs, modes=(16,))
35+
model = FourierNeuralOperator(gelu; chs, modes=(16,), permuted=Val(true))
3636
ps, st = Lux.setup(rng, model)
3737
model(x, ps, st) # TTFX
3838

0 commit comments

Comments
 (0)