Registration is open for TensorFlow Dev Summit 2020 Learn more

tensorflow::TensorBuffer

This is an abstract class.

#include <tensor.h>

Summary

Interface to access the raw ref-counted data buffer.

Inheritance

Inherits from: RefCounted

Constructors and Destructors

TensorBuffer(void *data_ptr)
~TensorBuffer()

Public functions

FillAllocationDescription(AllocationDescription *proto) const =0
virtual void
Fills metadata about the allocation into the proto.
GetAllocatedBytes(size_t *out_bytes) const
virtual bool
OwnsMemory() const
virtual bool
Whether this TensorBuffer owns the underlying memory.
base() const
T *
Helper method to reinterpret the buffer as an array of T.
data() const
void *
data() points to a memory region of size() bytes.
root_buffer()=0
virtual TensorBuffer *
If this TensorBuffer is sub-buffer of another TensorBuffer, returns that TensorBuffer.
size() const =0
virtual size_t
Size (in bytes) of the buffer.

Public functions

FillAllocationDescription

virtual void FillAllocationDescription(
  AllocationDescription *proto
) const =0

Fills metadata about the allocation into the proto.

GetAllocatedBytes

virtual bool GetAllocatedBytes(
  size_t *out_bytes
) const 

OwnsMemory

virtual bool OwnsMemory() const 

Whether this TensorBuffer owns the underlying memory.

TensorBuffer

 TensorBuffer(
  void *data_ptr
)

base

T * base() const 

Helper method to reinterpret the buffer as an array of T.

data

void * data() const 

data() points to a memory region of size() bytes.

NOTE(mrry): The data() method is not virtual for performance reasons. It can be called multiple times when the contents of a Tensor are accessed, and so making it non-virtual allows the body to be inlined.

root_buffer

virtual TensorBuffer * root_buffer()=0

If this TensorBuffer is sub-buffer of another TensorBuffer, returns that TensorBuffer.

Otherwise, returns this.

size

virtual size_t size() const =0

Size (in bytes) of the buffer.

~TensorBuffer

 ~TensorBuffer() override