Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions litert/cc/litert_tensor_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ Expected<TensorBuffer> TensorBuffer::CreateManaged(
return TensorBuffer(tensor_buffer, OwnHandle::kYes);
}

Expected<TensorBuffer> TensorBuffer::CreateManaged(
TensorBufferType buffer_type, const RankedTensorType& tensor_type,
size_t buffer_size) {
return CreateManaged(static_cast<LiteRtTensorBufferType>(buffer_type),
tensor_type, buffer_size);
}

Expected<TensorBuffer> TensorBuffer::CreateFromHostMemory(
const Environment&, const RankedTensorType& tensor_type,
void* host_mem_addr, size_t buffer_size) {
Expand Down
7 changes: 7 additions & 0 deletions litert/cc/litert_tensor_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ class TensorBuffer
const Environment& env, TensorBufferType buffer_type,
const RankedTensorType& tensor_type, size_t buffer_size);

// Creates a managed TensorBuffer object in the given buffer type using the
// default environment (if applicable). The returned object is owned by the
// caller.
static Expected<TensorBuffer> CreateManaged(
TensorBufferType buffer_type, const RankedTensorType& tensor_type,
size_t buffer_size);

[[deprecated(
"Use the overload that takes litert::TensorBufferType instead.")]]
static Expected<TensorBuffer> CreateManaged(
Expand Down
Loading