Loading...
Searching...
No Matches
opennn::Buffer Struct Reference

#include <opennn/core/tensor_types.h>

Public Member Functions

 Buffer (Device initial_device=Device::CPU)
 
 Buffer (const Buffer &)=delete
 
Buffer & operator= (const Buffer &)=delete
 
 Buffer (Buffer &&other) noexcept
 
Buffer & operator= (Buffer &&other) noexcept
 
 ~Buffer ()
 
template<typename T>
T * as ()
 
template<typename T>
const T * as () const
 
void * data () const noexcept
 
Index byte_size () const noexcept
 
Device get_device () const noexcept
 
bool owns_memory () const noexcept
 
Index size_in_floats () const noexcept
 
bool empty () const noexcept
 
VectorMap as_vector () &
 
ConstVectorMap as_vector () const &
 
void resize_bytes (Index byte_count, Device new_device)
 
void set_view (void *external_data, Index byte_count, Device view_device)
 
void grow_to (Index minimum_bytes)
 
template<typename T>
T * ensure (Index element_count)
 
void setZero ()
 
void migrate_to (Device target_device, DeviceStream stream=nullptr)
 
void swap (Buffer &other) noexcept
 

Constructor & Destructor Documentation

◆ Buffer() [1/3]

opennn::Buffer::Buffer ( Device initial_device = Device::CPU)
inlineexplicit

◆ Buffer() [2/3]

opennn::Buffer::Buffer ( const Buffer & )
delete

◆ Buffer() [3/3]

opennn::Buffer::Buffer ( Buffer && other)
inlinenoexcept

◆ ~Buffer()

opennn::Buffer::~Buffer ( )
inline

Member Function Documentation

◆ as() [1/2]

template<typename T>
T * opennn::Buffer::as ( )
inline

◆ as() [2/2]

template<typename T>
const T * opennn::Buffer::as ( ) const
inline

◆ as_vector() [1/2]

VectorMap opennn::Buffer::as_vector ( ) &
inline

◆ as_vector() [2/2]

ConstVectorMap opennn::Buffer::as_vector ( ) const &
inline

◆ byte_size()

Index opennn::Buffer::byte_size ( ) const
inlinenoexcept

◆ data()

void * opennn::Buffer::data ( ) const
inlinenoexcept

◆ empty()

bool opennn::Buffer::empty ( ) const
inlinenoexcept

◆ ensure()

template<typename T>
T * opennn::Buffer::ensure ( Index element_count)
inline

◆ get_device()

Device opennn::Buffer::get_device ( ) const
inlinenoexcept

◆ grow_to()

void opennn::Buffer::grow_to ( Index minimum_bytes)
inline

◆ migrate_to()

void opennn::Buffer::migrate_to ( Device target_device,
DeviceStream stream = nullptr )
inline

◆ operator=() [1/2]

Buffer & opennn::Buffer::operator= ( Buffer && other)
inlinenoexcept

◆ operator=() [2/2]

Buffer & opennn::Buffer::operator= ( const Buffer & )
delete

◆ owns_memory()

bool opennn::Buffer::owns_memory ( ) const
inlinenoexcept

◆ resize_bytes()

void opennn::Buffer::resize_bytes ( Index byte_count,
Device new_device )
inline

◆ set_view()

void opennn::Buffer::set_view ( void * external_data,
Index byte_count,
Device view_device )
inline

◆ setZero()

void opennn::Buffer::setZero ( )
inline

◆ size_in_floats()

Index opennn::Buffer::size_in_floats ( ) const
inlinenoexcept

◆ swap()

void opennn::Buffer::swap ( Buffer & other)
inlinenoexcept