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

Function GetTensorMessage

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

Source from the content-addressed store, hash-verified

969}
970
971Result<std::unique_ptr<Message>> GetTensorMessage(const Tensor& tensor,
972 MemoryPool* pool) {
973 const Tensor* tensor_to_write = &tensor;
974 std::unique_ptr<Tensor> temp_tensor;
975
976 if (!tensor.is_contiguous()) {
977 RETURN_NOT_OK(GetContiguousTensor(tensor, pool, &temp_tensor));
978 tensor_to_write = temp_tensor.get();
979 }
980
981 IpcWriteOptions options;
982 options.alignment = kTensorAlignment;
983 std::shared_ptr<Buffer> metadata;
984 ARROW_ASSIGN_OR_RAISE(metadata,
985 internal::WriteTensorMessage(*tensor_to_write, 0, options));
986 return std::make_unique<Message>(metadata, tensor_to_write->data());
987}
988
989namespace internal {
990

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