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

Method AllocateRaw

tensorflow/compiler/jit/xla_device_context.cc:41–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39string XlaDeviceAllocator::Name() { return "xla"; }
40
41void* XlaDeviceAllocator::AllocateRaw(size_t alignment, size_t num_bytes) {
42 // We always return an empty XlaTensor object, encoded as an opaque tagged
43 // pointer. We can return an empty object and ignore num_bytes here because we
44 // have control over all of the uses of this device tensor, and can lazily
45 // allocate memory when used. This allows us to also know the shape of the
46 // allocated Tensor, which is useful if the device's tensor representation
47 // differs from the host.
48 return XlaTensor::ToOpaquePointer(new XlaTensor());
49}
50
51void XlaDeviceAllocator::DeallocateRaw(void* ptr) {
52 delete XlaTensor::FromOpaquePointer(ptr);

Callers 6

AllocateMethod · 0.45
TfLiteTensorBufferMethod · 0.45
FromHostBufferMethod · 0.45
allocate_tensorFunction · 0.45
TESTFunction · 0.45

Calls

no outgoing calls

Tested by 2

TESTFunction · 0.36