joschu / cgt

Computation Graph Toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fancy non-flat indexing

joschu opened this issue · comments

Currently, you can do this:

x[0:2,:], x[0:2,1:3]

which uses GetSli, and this:

x[ cgt.arange(0,10), cgt.arange(0,20,2) ]

which uses GetFlatIndices op after computing the flat indices for the expression.

But you can't do this:

x[ [1,3], : ]

We should have an Op that looks like GetSli but takes an integer vector of indices along some axis, say, GetFancySli

Is it required to implement something like a lookup table commonly used in networks that learn word embeddings? Or there is some workaround?

Implemented in a43259d