Open WhiteBlackGoose opened 2 years ago
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];
}
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 forceIEnumerable
).