A flexable HTM (Hierarchical Temporal Memory) framework with full GPU support.
BSD 3-Clause "New" or "Revised" License
89
stars
14
forks
source link
Providing operator [] for et::Tensor (or at least a better way to handle tensor subscription) #71
Closed
marty1885 closed 4 years ago
Numpy's way of doing ND array subscription is widely accepted and straight forward.
ex:
Due to the fact that C++'s
operator []
can only take one argument. I ended up implementing aview()
method to perform subscription.ex:
But TBH, it gets annoying when I start to write more code with it. It would be great to have a [] equivalent in Etaler. We have a few solution.
Tensor Tensor::operator [] (svector<Range>)
Which will allow us to do
There is an extra bracket around the parameters.
Tensor Tensor::operator [] (svector<Range>)
and overloadRange::operator , ()
Which allows us to
It gives us the syntax we want. But messes with how C++ evaluates values.
operator ()
This is ArrayFire's solution. It feels weird to subscript using () instead of [].
It feels like calling a function....
Any ideas?