Support slicing a shallow copy of a 3-d tensor (#83)

This commit is contained in:
Fangjun Kuang
2023-03-05 19:18:31 +08:00
committed by GitHub
parent 422221b3b4
commit 7cae710751
5 changed files with 98 additions and 6 deletions

View File

@@ -57,9 +57,6 @@ Ort::Value GetEncoderOutFrame(OrtAllocator *allocator, Ort::Value *encoder_out,
auto offset = num_frames * encoder_out_dim;
auto memory_info =
Ort::MemoryInfo::CreateCpu(OrtDeviceAllocator, OrtMemTypeDefault);
std::array<int64_t, 2> shape{batch_size, encoder_out_dim};
Ort::Value ans =
@@ -90,9 +87,6 @@ Ort::Value Clone(OrtAllocator *allocator, const Ort::Value *v) {
auto type_and_shape = v->GetTensorTypeAndShapeInfo();
std::vector<int64_t> shape = type_and_shape.GetShape();
auto memory_info =
Ort::MemoryInfo::CreateCpu(OrtDeviceAllocator, OrtMemTypeDefault);
switch (type_and_shape.GetElementType()) {
case ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32: {
Ort::Value ans = Ort::Value::CreateTensor<int32_t>(