diff --git a/ppsci/arch/deeponet.py b/ppsci/arch/deeponet.py index 374c09cd3..16a8807d8 100644 --- a/ppsci/arch/deeponet.py +++ b/ppsci/arch/deeponet.py @@ -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", @@ -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__( diff --git a/ppsci/arch/mlp.py b/ppsci/arch/mlp.py index b4e5f9858..0bc87a447 100644 --- a/ppsci/arch/mlp.py +++ b/ppsci/arch/mlp.py @@ -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__(