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

Iterate to return state machine object #36

Open
WhiteBlackGoose opened this issue Jun 4, 2022 · 1 comment
Open

Iterate to return state machine object #36

WhiteBlackGoose opened this issue Jun 4, 2022 · 1 comment
Labels

Comments

@WhiteBlackGoose
Copy link
Member

It currently returns IEnumerable, which has a virtual call. We can make it much faster by writing a value type state machine (foreach does not force IEnumerable).

@WhiteBlackGoose
Copy link
Member Author

For internal API there should be an indexing state machine which would work like this:

Span<int> id = stackalloc[shape.Length];
var indexMachine = new IndexIterator(id);
while (indexMachine.Move())
{
    myTensor[id] = myTensor[id];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant