MCPcopy Create free account
hub / github.com/apache/arrow / GetTensorMessage

Function GetTensorMessage

cpp/src/arrow/ipc/writer.cc:959–975  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

957}
958
959Result<std::unique_ptr<Message>> GetTensorMessage(const Tensor& tensor,
960 MemoryPool* pool) {
961 const Tensor* tensor_to_write = &tensor;
962 std::unique_ptr<Tensor> temp_tensor;
963
964 if (!tensor.is_contiguous()) {
965 RETURN_NOT_OK(GetContiguousTensor(tensor, pool, &temp_tensor));
966 tensor_to_write = temp_tensor.get();
967 }
968
969 IpcWriteOptions options;
970 options.alignment = kTensorAlignment;
971 std::shared_ptr<Buffer> metadata;
972 ARROW_ASSIGN_OR_RAISE(metadata,
973 internal::WriteTensorMessage(*tensor_to_write, 0, options));
974 return std::make_unique<Message>(metadata, tensor_to_write->data());
975}
976
977namespace internal {
978

Callers

nothing calls this directly

Calls 6

GetContiguousTensorFunction · 0.85
WriteTensorMessageFunction · 0.85
is_contiguousMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
getMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected