Skip to content

Commit

Permalink
【PPSCI Doc No.18、19】 (#732)
Browse files Browse the repository at this point in the history
* refine docs for ppsci.arch.MLP, ppsci.arch.DeepONet

* fix
  • Loading branch information
MayYouBeProsperous committed Jan 2, 2024
1 parent a57b3d8 commit fcb26c2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ppsci/arch/deeponet.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class DeepONet(base.Arch):
use_bias (bool, optional): Whether to add bias on predicted G(u)(y). Defaults to True.
Examples:
>>> import paddle
>>> import ppsci
>>> model = ppsci.arch.DeepONet(
... "u", "y", "G",
Expand All @@ -60,6 +61,11 @@ class DeepONet(base.Arch):
... branch_activation="relu", trunk_activation="relu",
... use_bias=True,
... )
>>> input_dict = {"u": paddle.rand([200, 100]),
... "y": paddle.rand([200, 1])}
>>> output_dict = model(input_dict)
>>> print(output_dict["G"].shape)
[200, 1]
"""

def __init__(
Expand Down
15 changes: 14 additions & 1 deletion ppsci/arch/mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,21 @@ class MLP(base.Arch):
output_dim (Optional[int]): Number of output's dimension. Defaults to None.
Examples:
>>> import paddle
>>> import ppsci
>>> model = ppsci.arch.MLP(("x", "y"), ("u", "v"), 5, 128)
>>> model = ppsci.arch.MLP(
... input_keys=("x", "y"),
... output_keys=("u", "v"),
... num_layers=5,
... hidden_size=128
... )
>>> input_dict = {"x": paddle.rand([64, 64, 1]),
... "y": paddle.rand([64, 64, 1])}
>>> output_dict = model(input_dict)
>>> print(output_dict["u"].shape)
[64, 64, 1]
>>> print(output_dict["v"].shape)
[64, 64, 1]
"""

def __init__(
Expand Down

0 comments on commit fcb26c2

Please sign in to comment.