GenericTensor
GenericTensor copied to clipboard
`Iterate` to return state machine object
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).
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];
}