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

Function GetTensorMessage

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

Source from the content-addressed store, hash-verified

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

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