MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / AppendFromBuffer

Function AppendFromBuffer

tensorflow/lite/delegates/gpu/gl/gl_buffer.h:136–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134// Adapts raw Buffer::Read method to read data into a vector.
135template <typename T>
136Status AppendFromBuffer(const GlBuffer& buffer, std::vector<T>* data) {
137 if (buffer.bytes_size() % sizeof(T) != 0) {
138 return InvalidArgumentError("Buffer is not aligned");
139 }
140 size_t num_elements = buffer.bytes_size() / sizeof(T);
141 data->resize(data->size() + num_elements);
142 return buffer.Read<T>(
143 absl::MakeSpan(data->data() + data->size() - num_elements, num_elements));
144}
145
146// Persistent buffer provides CPU pointer to the buffer that is valid all the
147// time. A user should properly synchronize the access to the buffer on CPU and

Callers 1

TESTFunction · 0.85

Calls 5

InvalidArgumentErrorFunction · 0.50
bytes_sizeMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by 1

TESTFunction · 0.68