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

Add enum for tensor layout #67

Open
oovm opened this issue Mar 5, 2024 · 4 comments
Open

Add enum for tensor layout #67

oovm opened this issue Mar 5, 2024 · 4 comments

Comments

@oovm
Copy link

oovm commented Mar 5, 2024

Is it possible to add an interface to get the tensor layout (memory format) of tensor?

Such as NCHW or NWHC, I hope that incorrect arrangements can be determined and rejected in wasm

@abrown
Copy link
Collaborator

abrown commented Mar 14, 2024

We've discussed this a few times in the past; maybe a summary of the current state is that we need some way to read graph metadata and potentially attach it to tensors. Your feedback on what is motivating this would be pretty helpful — can you attend the ML working group on the 18th of this month (details)?

@oovm
Copy link
Author

oovm commented Mar 15, 2024

Sorry, I can't attend this meeting, I am not an English speaker, I use Google and chatgpt to translate the conversation, but I will pay attention to the meeting minutes.

@abrown
Copy link
Collaborator

abrown commented Mar 15, 2024

No problem; I will relay this request in the meeting then.

abrown added a commit to abrown/bytecodealliance-meetings that referenced this issue Mar 15, 2024
ricochet pushed a commit to bytecodealliance/meetings that referenced this issue Mar 16, 2024
@abrown
Copy link
Collaborator

abrown commented Mar 18, 2024

@oovm, we discussed this at the last ML meeting (here) and here is a summary of that discussion:

  • the difference between NHWC, NCHW, etc. is specific to tensors that represent images
  • wasi-nn is a system-level API and cannot possibly provide developer-friendly features for every specific ML use case
  • if it were to provide something like this metadata, it might need to be more unstructured than an enum (e.g., key-value strings) and be accessible from the graph resource, not at the tensor level
  • some of those present have discussed adding unstructured metadata to graphs, so that may be an avenue to explore
  • but, in the end, that additional information doesn't free the developer from knowing how to properly interface with the ML model they choose to do inference with; being able to extract some model metadata doesn't fully solve the problem of making this API easier to use

I believe there is plenty of room above the system API level for an ease-of-use wrapper library; there are the beginnings of this kind of thing over in this repository.

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

No branches or pull requests

2 participants