lululxvi / deepxde

A library for scientific machine learning and physics-informed learning
https://deepxde.readthedocs.io
GNU Lesser General Public License v2.1
2.77k stars 760 forks source link

Tensorflow 1.x backend: layer-by-layer dropout rate setting for DeepONet #1792

Closed vl-dud closed 3 months ago

vl-dud commented 4 months ago

Now you can set dropout_rate more flexibly:

net = dde.nn.DeepONet(
    [10, 128, 128, 128],
    [dim_x, 128, 128, 128],
    "tanh",
    "Glorot normal",
    dropout_rate={
        "branch": [0.5, 0.3],
        "trunk": [0.5, 0.3, 0.2]
    },
)
lululxvi commented 4 months ago

There are a lot of code like this

if isinstance(self.dropout_rate_branch, list):

To simplify the code, you can convert the single dropout to a list as well. Then in the code, there is no need to use if to check.

vl-dud commented 4 months ago

Fixed