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

Use names instead of numbers to identify inputs and outputs #48

Closed
abrown opened this issue Aug 14, 2023 · 1 comment · Fixed by #61
Closed

Use names instead of numbers to identify inputs and outputs #48

abrown opened this issue Aug 14, 2023 · 1 comment · Fixed by #61

Comments

@abrown
Copy link
Collaborator

abrown commented Aug 14, 2023

I've heard this feedback from several people recently and wanted to open this up for discussion: many ML frameworks now use names (i.e., strings) instead of numeric indexes for identifying inputs and outputs. Currently set-input and get-output both use numeric indexes. Should we switch the API to use names instead?

The current API would replace set-input and get-output with:

set-input: func(ctx: graph-execution-context, name: string, tensor: tensor) -> result<_, error>
get-output: func(ctx: graph-execution-context, name: string) -> result<tensor-data, error>

If #43 is adopted, which removes graph-execution-context, then the compute call would change to:

type tensor-map = list<tuple<string, tensor>>
compute: func(inputs: tensor-map) -> result<tensor-map, error>
@abrown abrown changed the title Use names instead of numbers to identify inputs Use names instead of numbers to identify inputs and outputs Aug 14, 2023
@geekbeast
Copy link
Contributor

This seems like a no brainer. Using indexes seems pretty brittle as it is decoupled from the semantic meaning of the value and makes for less clear code (i.e poor developer experience for users of the api)

abrown added a commit to abrown/wasi-nn-spec that referenced this issue Oct 28, 2023
abrown added a commit to abrown/wasi-nn-spec that referenced this issue Oct 28, 2023
@abrown abrown closed this as completed in #61 Nov 9, 2023
abrown added a commit that referenced this issue Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants