Number of bytes needed to store this tensor data.
| 343 | |
| 344 | /// Number of bytes needed to store this tensor data. |
| 345 | Result<int64_t> ComputeNumBytes() const { |
| 346 | ARROW_ASSIGN_OR_RAISE(const auto nelements, ComputeNumElements()); |
| 347 | int64_t nbytes = 0; |
| 348 | if (ARROW_PREDICT_FALSE(internal::MultiplyWithOverflow( |
| 349 | nelements, static_cast<int64_t>(byte_width()), &nbytes))) { |
| 350 | return Status::Invalid("Overflow computing DLPack tensor size in bytes."); |
| 351 | } |
| 352 | return nbytes; |
| 353 | } |
| 354 | |
| 355 | private: |
| 356 | struct Deleter { |
nothing calls this directly
no test coverage detected