Add PackPaddedSequence (#85)

This commit is contained in:
Fangjun Kuang
2023-03-08 14:12:20 +08:00
committed by GitHub
parent 3a79115884
commit 8c6a289e3d
7 changed files with 236 additions and 21 deletions

View File

@@ -8,21 +8,23 @@
namespace sherpa_onnx {
/** Get a shallow copy by slicing v.
/** Get a deep copy by slicing v.
*
* It returns v[dim0, dim1_start:dim1_end]
* It returns v[dim0_start:dim0_end, dim1_start:dim1_end]
*
* @param allocator
* @param v A 3-D tensor. Its data type is T.
* @param dim0 Start index of the first dimension..
* @param dim0_start Start index of the first dimension..
* @param dim0_end End index of the first dimension..
* @param dim1_start Start index of the second dimension.
* @param dim1_end End index of the second dimension.
*
* @return Return a 2-D tensor of shape (dim1_end-dim1_start, v.shape[2])
*
* @caution: The returned tensor is a shallow copy of `v`!
* @return Return a 3-D tensor of shape
* (dim0_end-dim0_start, dim1_end-dim1_start, v.shape[2])
*/
template <typename T = float>
Ort::Value Slice(const Ort::Value *v, int32_t dim0, int32_t dim1_start,
Ort::Value Slice(OrtAllocator *allocator, const Ort::Value *v,
int32_t dim0_start, int32_t dim0_end, int32_t dim1_start,
int32_t dim1_end);
} // namespace sherpa_onnx