镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Iterate to return state machine object #36

Open

Description

@WhiteBlackGoose

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).

Activity

  1. WhiteBlackGoose commented on Jun 4, 2022

    @WhiteBlackGoose
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions