Skip to content

Conversation

yangrongxinuser
Copy link

PR types

Others

PR changes

Others

Describe

为amgnet_cylinder算子添加export和inference功能

Copy link

paddle-bot bot commented Nov 22, 2024

Thanks for your contribution!

@CLAassistant
Copy link

CLAassistant commented Nov 22, 2024

CLA assistant check
All committers have signed the CLA.

@HydrogenSulfate
Copy link
Collaborator

@yangrongxinuser 提交代码前请安装pre-commit

@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Nov 25, 2024
Comment on lines +217 to +244
def inference(model_path: str, input_data_path: str):

model = paddle.jit.load(model_path)
model.eval()

input_data = np.load(input_data_path, allow_pickle=True)
input_graph = input_data["input_graph"]

graph = ppsci.utils.GraphData(
nodes=input_graph["node_features"],
edges=input_graph["edges"],
edge_features=input_graph["edge_features"],
)

with paddle.no_grad():
predictions = model(graph)

return {
"velocity_x": predictions["velocity_x"].numpy(),
"velocity_y": predictions["velocity_y"].numpy(),
"pressure": predictions["pressure"].numpy(),
}


result = inference("pretrained_model.pdparams", "input_graph_data.npz")
print("Velocity X:", result["velocity_x"])
print("Velocity Y:", result["velocity_y"])
print("Pressure:", result["pressure"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. 这段代码能运行吗?
  2. 没有实现export函数

@luotao1 luotao1 closed this Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants