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

相关资源
在火山引擎云搜索服务上构建混合搜索的设计与实现
本次演讲将重点介绍字节跳动在混合搜索领域的探索,并探讨如何在多模态数据场景下进行海量数据搜索。
相关产品
评论
未登录
看完啦,登录分享一下感受吧~
暂无评论