Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.

Commit 70d870d

Browse files
committed
Update docs
1 parent 1e28d83 commit 70d870d

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

docs/src/apis.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
## Layers
77

8-
### Spectral convolutional layer
8+
### Operator convolutional layer
99

1010
```math
1111
F(s) = \mathcal{F} \{ v(x) \} \\
@@ -25,7 +25,7 @@ Reference: [Fourier Neural Operator for Parametric Partial Differential Equation
2525

2626
---
2727

28-
### Fourier operator layer
28+
### Operator kernel layer
2929

3030
```math
3131
v_{t+1}(x) = \sigma(W v_t(x) + \mathcal{K} \{ v_t(x) \} )

docs/src/index.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ It performs Fourier transformation across infinite-dimensional function spaces a
3030
With only one time step information of learning, it can predict the following few steps with low loss
3131
by linking the operators into a Markov chain.
3232

33-
**DeepONet operator** (Deep Operator Network)learns a neural operator with the help of two sub-neural net structures described as the branch and the trunk network. The branch network is fed the initial conditions data, whereas the trunk is fed with the locations where the target(output) is evaluated from the corresponding initial conditions. It is important that the output size of the branch and trunk subnets is same so that a dot product can be performed between them.
33+
**DeepONet operator** (Deep Operator Network) learns a neural operator with the help of two sub-neural net structures described as the branch and the trunk network.
34+
The branch network is fed the initial conditions data, whereas the trunk is fed with the locations where the target(output) is evaluated from the corresponding initial conditions.
35+
It is important that the output size of the branch and trunk subnets is same so that a dot product can be performed between them.
3436

3537
Currently, the `OperatorKernel` layer is provided in this work.
3638
As for model, there are `FourierNeuralOperator` and `MarkovNeuralOperator` provided.
@@ -54,10 +56,10 @@ model = Chain(
5456
# here, d == 1 and n == 64
5557
Dense(2, 64),
5658
# map each hidden representation to the next by integral kernel operator
57-
OperatorKernel(64=>64, (16, ), gelu),
58-
OperatorKernel(64=>64, (16, ), gelu),
59-
OperatorKernel(64=>64, (16, ), gelu),
60-
OperatorKernel(64=>64, (16, )),
59+
OperatorKernel(64=>64, (16, ), FourierTransform, gelu),
60+
OperatorKernel(64=>64, (16, ), FourierTransform, gelu),
61+
OperatorKernel(64=>64, (16, ), FourierTransform, gelu),
62+
OperatorKernel(64=>64, (16, ), FourierTransform),
6163
# project back to the scalar field of interest space
6264
Dense(64, 128, gelu),
6365
Dense(128, 1),
@@ -86,27 +88,28 @@ Flux.@epochs 50 Flux.train!(loss, params(model), data, opt)
8688
### DeepONet
8789

8890
```julia
89-
#tuple of Ints for branch net architecture and then for trunk net, followed by activations for branch and trunk respectively
90-
model = DeepONet((32,64,72), (24,64,72), σ, tanh)
91+
# tuple of Ints for branch net architecture and then for trunk net,
92+
# followed by activations for branch and trunk respectively
93+
model = DeepONet((32, 64, 72), (24, 64, 72), σ, tanh)
9194
```
9295

9396
Or specify branch and trunk as separate `Chain` from Flux and pass to `DeepONet`
9497

9598
```julia
96-
branch = Chain(Dense(32,64,σ), Dense(64,72,σ))
97-
trunk = Chain(Dense(24,64,tanh), Dense(64,72,tanh))
98-
model = DeepONet(branch,trunk)
99+
branch = Chain(Dense(32, 64, σ), Dense(64, 72, σ))
100+
trunk = Chain(Dense(24, 64, tanh), Dense(64, 72, tanh))
101+
model = DeepONet(branch, trunk)
99102
```
100103

101104
You can again specify loss, optimization and training parameters just as you would for a simple neural network with Flux.
102105

103106
```julia
104-
loss(xtrain,ytrain,sensor) = Flux.Losses.mse(model(xtrain,sensor),ytrain)
105-
evalcb() = @show(loss(xval,yval,grid))
107+
loss(xtrain, ytrain, sensor) = Flux.Losses.mse(model(xtrain, sensor), ytrain)
108+
evalcb() = @show(loss(xval, yval, grid))
106109

107110
learning_rate = 0.001
108111
opt = ADAM(learning_rate)
109112
parameters = params(model)
110-
Flux.@epochs 400 Flux.train!(loss, parameters, [(xtrain,ytrain,grid)], opt, cb = evalcb)
113+
Flux.@epochs 400 Flux.train!(loss, parameters, [(xtrain, ytrain, grid)], opt, cb=evalcb)
111114
```
112115
A more complete example using DeepONet architecture to solve Burgers' equation can be found in the [examples](../../example/Burgers/src/Burgers_deeponet.jl)

0 commit comments

Comments
 (0)