WasmEdge / wasmedge-rust-sdk

Embed WasmEdge functions in a Rust host app
Apache License 2.0
30 stars 15 forks source link

[Refactor] Update `GraphEncoding` and `ExecutionTarget` in `wasmedge-sdk::plugin` #75

Closed apepkuss closed 1 year ago

apepkuss commented 1 year ago

In this PR, refactor GraphEncoding and ExecutionTarget types to keep their names consistent with the counterparts defined in wasi-nn crate (v0.6.0).

In addition, support for the conversion from Strings to Enum variants.

juntao commented 1 year ago

Hello, I am a code review bot on flows.network. Here are my reviews of code commits in this PR.


Overall Summary:

The pull request titled "[Refactor] Update GraphEncoding and ExecutionTarget in wasmedge-sdk::plugin" introduces several changes to the codebase. The key changes include adding new variants to the GraphEncoding and ExecutionTarget enums, updating the implementations of Display and FromStr for the GraphEncoding enum, and adding a conditional import.

While most of the changes are straightforward, there are a few potential issues and errors that need to be addressed. These include a typo in the formatting of a variant in the NNBackend enum, the need for additional changes to fully support the new variant NNBackend::TensorFlow, outdated comments and code in the NNPreload struct, and incomplete error handling in the implementations of FromStr for both enums.

It is important to address these issues and errors before merging the pull request.

Details

Commit 69358fb6ea3cb18d910de3f5329f61b0ea7bde5c

Key changes:

Potential problems:

Overall, the changes seem to be straightforward and introduce new options for the NNBackend. However, the typo in the formatting and the potential impact of the new variant should be addressed.

Commit 78d44584244116aa56a9fd629faf030faa8473d7

Key changes:

Potential problems:

Overall, the key changes involve renaming and updating the enums NNBackend and ExecutionTarget. Some comments and code in the NNPreload struct need to be updated accordingly. Additionally, the implementations of FromStr for both enums should handle unknown input strings correctly by returning an error.

Commit 0d93da98eb0d270fc4b2a8236c693c0003056a00

Key changes:

Potential problem: