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

Function TF_NewBufferFromString

tensorflow/c/c_api.cc:132–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130TF_Buffer* TF_NewBuffer() { return new TF_Buffer{nullptr, 0, nullptr}; }
131
132TF_Buffer* TF_NewBufferFromString(const void* proto, size_t proto_len) {
133 void* copy = tensorflow::port::Malloc(proto_len);
134 memcpy(copy, proto, proto_len);
135
136 TF_Buffer* buf = new TF_Buffer;
137 buf->data = copy;
138 buf->length = proto_len;
139 buf->data_deallocator = [](void* data, size_t length) {
140 tensorflow::port::Free(data);
141 };
142 return buf;
143}
144
145void TF_DeleteBuffer(TF_Buffer* buffer) {
146 if (buffer == nullptr) return;

Calls 2

MallocFunction · 0.50
FreeFunction · 0.50

Tested by 1

TESTFunction · 0.68