k2 之 ragged ops (二)

技术

Index

  
/*  
  Indexing operation on ragged tensor's shape.  
  
      @param [in] src      Source ragged tensor to index  
      @param [in] axis     Axis to index `src` on, must satisfy  
                           0 <= src < src.NumAxes().  
      @param [in] indexes  Array of indexes, which will be interpreted  
                           as indexes into axis `axis` of `src`,  
                           i.e. with 0 <= indexes[i] < src.TotSize(axis).  
  
                           As a special case, if axis == 0 we also support  
                           -1 as an index, which will result in the  
                           empty list (as if it were the index into  
                           a position in `src` that had an empty list  
                           at that point).  
  
                           CAUTION: these are currently not allowed to  
                           change the order on axes less than `axis`,  
                           i.e. if axis > 0, we require.  
                           `IsMonotonic(src.RowIds(axis)[indexes])`.  
  
      @param [out]         If non-null, this will be set to an  
                           Array1<int32\_t> containing the indexes  
                           into the elements of an array with shape  
                           'src', that an array with shape 'ans'  
                           would have (a new2old map).  As in:  
                           `ans\_values = src\_values[*elem\_indexes]`.  
                           If `axis == src.NumAxes()-1`, this will  
                           be aliased with `indexes`.  
  
      @return Returns a ragged shape with  
              `ans.NumAxes() == src.NumAxes()`  
              and `ans.TotSize(axis) == indexes.Dim()`.  
  
  NOET: if you are looking for something like ReorderRaggedShape(),  
  RenumberRaggedShape() or the like, this may be what you want.  
  (Reordering/renumbering is a special case of indexing)  
*/  

0
0
0
0
关于作者

文章

0

获赞

0

收藏

0

相关资源
字节跳动 NoSQL 的实践与探索
随着 NoSQL 的蓬勃发展越来越多的数据存储在了 NoSQL 系统中,并且 NoSQL 和 RDBMS 的界限越来越模糊,各种不同的专用 NoSQL 系统不停涌现,各具特色,形态不一。本次主要分享字节跳动内部和火山引擎 NoSQL 的实践,希望能够给大家一定的启发。
相关产品
评论
未登录
看完啦,登录分享一下感受吧~
暂无评论