| 428 | } |
| 429 | |
| 430 | Result<std::vector<int64_t>> StridesInBytes(std::span<const int64_t> strides, |
| 431 | int64_t byte_width) { |
| 432 | std::vector<int64_t> out{}; |
| 433 | out.reserve(strides.size()); |
| 434 | for (const auto& s : strides) { |
| 435 | int64_t stride_bytes = 0; |
| 436 | if (ARROW_PREDICT_FALSE( |
| 437 | internal::MultiplyWithOverflow(s, byte_width, &stride_bytes))) { |
| 438 | return Status::Invalid("Overflow computing DLPack tensor stride in bytes."); |
| 439 | } |
| 440 | out.push_back(stride_bytes); |
| 441 | } |
| 442 | return out; |
| 443 | } |
| 444 | |
| 445 | Result<std::shared_ptr<Buffer>> ImportBuffer(CppDLTensor&& dl) { |
| 446 | ARROW_ASSIGN_OR_RAISE(const int64_t nbytes, dl.ComputeNumBytes()); |
nothing calls this directly
no test coverage detected