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

Method Decode

tensorflow/core/framework/tensor.cc:168–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166 // tensor buffer.
167 template <typename Source>
168 static TensorBuffer* Decode(Allocator* a, const Source& in, int64 n) {
169 if (in.size() != sizeof(T) * n) {
170 LogUnexpectedSize(in.size(), sizeof(T) * n);
171 return nullptr;
172 }
173 Buffer<T>* buf = new Buffer<T>(a, n);
174 char* data = buf->template base<char>();
175 if (data == nullptr) {
176 buf->Unref();
177 return nullptr;
178 }
179 port::CopyToArray(in, data);
180 return buf;
181 }
182
183 // Memory usage.
184 static int64 TotalBytes(TensorBuffer* in, int64 n) {

Callers

nothing calls this directly

Calls 4

LogUnexpectedSizeFunction · 0.85
CopyToArrayFunction · 0.85
sizeMethod · 0.45
UnrefMethod · 0.45

Tested by

no test coverage detected