Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【PPSCI Doc No.10、11、30】 #724

Merged
merged 3 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions ppsci/arch/cfdgcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,23 @@ class CFDGCN(nn.Layer):
hidden_channel (int, optional): Number of channels of hidden layer. Defaults to 512.
out_channel (int, optional): Number of channels of output. Defaults to 3.
su2_module (Optional[Callable]): SU2Module Object. Defaults to None.

Examples:
>>> import ppsci
>>> import su2paddle # doctest: +SKIP
>>> model = ppsci.arch.CFDGCN(
... input_keys=("input"),
... output_keys=("pred"),
... config_file="/path/to/file.cfg",
... coarse_mesh="/path/to/file.su2",
... process_sim=None,
... freeze_mesh=False,
... num_convs=6,
... num_end_convs=3,
... hidden_channel=512,
... out_channel=3,
... su2_module=su2paddle.SU2Module,
... ) # doctest: +SKIP
"""

def __init__(
Expand Down
23 changes: 20 additions & 3 deletions ppsci/arch/unetex.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ def create_decoder(


class UNetEx(base.Arch):
"""U-Net
"""U-Net Extension for CFD.

[Ribeiro M D, Rehman A, Ahmed S, et al. DeepCFD: Efficient steady-state laminar flow approximation with deep convolutional neural networks[J]. arXiv preprint arXiv:2004.08826, 2020.](https://arxiv.org/abs/2004.08826)
Reference: [Ribeiro M D, Rehman A, Ahmed S, et al. DeepCFD: Efficient steady-state laminar flow approximation with deep convolutional neural networks[J]. arXiv preprint arXiv:2004.08826, 2020.](https://arxiv.org/abs/2004.08826)

Args:
input_key (str): Name of function data for input.
Expand All @@ -193,7 +193,24 @@ class UNetEx(base.Arch):

Examples:
>>> import ppsci
>>> model = ppsci.arch.ppsci.arch.UNetEx("input", "output", 3, 3, (8, 16, 32, 32), 5, False, False)
>>> model = ppsci.arch.UNetEx(
... input_key="input",
... output_key="output",
... in_channel=3,
... out_channel=3,
... kernel_size=5,
... filters=(4, 4, 4, 4),
... layers=3,
... weight_norm=False,
... batch_norm=False,
... activation=None,
... final_activation=None,
... )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是否可以构造一个input_dict,然后输入到该model里,然后得到output_dict,再打印output_dict["output"]呢?上面那个CFDGCN不太方便加这个测试,但是UNetEx应该可以吧

Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate Dec 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果可以的话形状可以用128x128或者64x64啥的,不用太大否则有的机器测试都跑不了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,UNetEx 增加测试。output_dict["output"] 需要打印对比吗?数据比较多。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,UNetEx 增加测试。output_dict["output"] 需要打印对比吗?数据比较多。

不用,只需要打印并校验输出数据的形状即可

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

>>> input_dict = {'input': paddle.rand([4, 3, 4, 4])}
>>> output_dict = model(input_dict)
>>> print(output_dict['output']) # doctest: +SKIP
>>> print(output_dict['output'].shape)
[4, 3, 4, 4]
"""

def __init__(
Expand Down
10 changes: 10 additions & 0 deletions ppsci/data/dataset/airfoil_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ class MeshAirfoilDataset(io.Dataset):
data_dir (str): Directory of MeshAirfoil data.
mesh_graph_path (str): Path of mesh graph.
transpose_edges (bool, optional): Whether transpose the edges array from (2, num_edges) to (num_edges, 2) for convenient of slicing.

Examples:
>>> import ppsci
>>> dataset = ppsci.data.dataset.MeshAirfoilDataset(
... "input_keys": ("input",),
... "label_keys": ("output",),
... "data_dir": "/path/to/MeshAirfoilDataset",
... "mesh_graph_path": "/path/to/file.su2",
... "transpose_edges": False,
... ) # doctest: +SKIP
"""

use_pgl: bool = True
Expand Down
9 changes: 9 additions & 0 deletions ppsci/data/dataset/cylinder_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ class MeshCylinderDataset(io.Dataset):
label_keys (Tuple[str, ...]): Name of label data.
data_dir (str): Directory of MeshCylinder data.
mesh_graph_path (str): Path of mesh graph.

Examples:
>>> import ppsci
>>> dataset = ppsci.data.dataset.MeshAirfoilDataset(
... "input_keys": ("input",),
... "label_keys": ("output",),
... "data_dir": "/path/to/MeshAirfoilDataset",
... "mesh_graph_path": "/path/to/file.su2",
... ) # doctest: +SKIP
"""

use_pgl: bool = True
Expand Down