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

Function CreateTensorBHWC

tensorflow/lite/delegates/gpu/cl/tensor.cc:413–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413Status CreateTensorBHWC(const CLContext& context, const HWC& shape,
414 DataType data_type, void* data, Tensor* result) {
415 const size_t data_size = shape.w * shape.h * shape.c * SizeOf(data_type);
416 cl_int error_code;
417 int flags =
418 data ? (CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR) : CL_MEM_READ_WRITE;
419 cl_mem memory =
420 clCreateBuffer(context.context(), flags, data_size, data, &error_code);
421 if (!memory) {
422 return UnknownError(
423 absl::StrCat("Failed to allocate device memory with clCreateBuffer",
424 CLErrorCodeToString(error_code)));
425 }
426
427 *result = TensorBHWC(memory, shape.w, shape.h, shape.c, data_type,
428 TensorStorageType::BUFFER);
429 return OkStatus();
430}
431
432Status CreateTensorBHWCFromOpenGlObject(const CLContext& context,
433 cl_int ssbo_id, const HWC& shape,

Callers

nothing calls this directly

Calls 7

CLErrorCodeToStringFunction · 0.85
TensorBHWCClass · 0.85
OkStatusFunction · 0.85
SizeOfFunction · 0.50
UnknownErrorFunction · 0.50
StrCatFunction · 0.50
contextMethod · 0.45

Tested by

no test coverage detected