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

#include <opennn/dataset/batch.h>

Public Member Functions

 Batch (Index, const Dataset *, const EffectiveConfig &, bool prefetch_only=false)
 
 ~Batch ()
 
 Batch (const Batch &)=delete
 
Batch & operator= (const Batch &)=delete
 
 Batch (Batch &&)=delete
 
Batch & operator= (Batch &&)=delete
 
void set (Index, const Dataset *, const EffectiveConfig &, bool prefetch_only=false)
 
void fill (const vector< Index > &sample_indices, const FeatureSelection &, FillMode mode=FillMode::Training)
 
const vector< TensorView > & get_inputs () const
 
const TensorView & get_targets () const
 
bool uses_cuda () const
 
Index get_batch_size () const
 
bool is_empty () const
 
void upload_to_device_batch_async (Batch &, DeviceStream)
 
void record_h2d_done (DeviceStream)
 
void wait_h2d_complete ()
 
void wait_h2d_on_compute_stream ()
 

Public Attributes

Index batch_size = 0
 
const Dataset * dataset = nullptr
 
BatchSlot input
 
BatchSlot decoder
 
BatchSlot target
 
device::PinnedBuffer input_host_bf16
 
Buffer fp32_staging {Device::CUDA}
 
device::CudaEvent h2d_done_event
 
bool h2d_done_recorded = false
 
vector< TensorView > input_views_host_cache
 
TensorView target_view_host_cache
 
vector< TensorView > input_views_cache
 
TensorView target_view_cache
 
optional< DeviceGather > device_gather
 
device::PinnedBuffer gather_indices_host
 
Buffer gather_indices_device {Device::CUDA}
 

Constructor & Destructor Documentation

◆ Batch() [1/3]

opennn::Batch::Batch ( Index ,
const Dataset * ,
const EffectiveConfig & ,
bool prefetch_only = false )

◆ ~Batch()

opennn::Batch::~Batch ( )

◆ Batch() [2/3]

opennn::Batch::Batch ( const Batch & )
delete

◆ Batch() [3/3]

opennn::Batch::Batch ( Batch && )
delete

Member Function Documentation

◆ fill()

void opennn::Batch::fill ( const vector< Index > & sample_indices,
const FeatureSelection & ,
FillMode mode = FillMode::Training )

◆ get_batch_size()

Index opennn::Batch::get_batch_size ( ) const
inline

◆ get_inputs()

const vector< TensorView > & opennn::Batch::get_inputs ( ) const
inline

◆ get_targets()

const TensorView & opennn::Batch::get_targets ( ) const
inline

◆ is_empty()

bool opennn::Batch::is_empty ( ) const
inline

◆ operator=() [1/2]

Batch & opennn::Batch::operator= ( Batch && )
delete

◆ operator=() [2/2]

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

◆ record_h2d_done()

void opennn::Batch::record_h2d_done ( DeviceStream )

◆ set()

void opennn::Batch::set ( Index ,
const Dataset * ,
const EffectiveConfig & ,
bool prefetch_only = false )

◆ upload_to_device_batch_async()

void opennn::Batch::upload_to_device_batch_async ( Batch & ,
DeviceStream  )

◆ uses_cuda()

bool opennn::Batch::uses_cuda ( ) const
inline

◆ wait_h2d_complete()

void opennn::Batch::wait_h2d_complete ( )

◆ wait_h2d_on_compute_stream()

void opennn::Batch::wait_h2d_on_compute_stream ( )

Member Data Documentation

◆ batch_size

Index opennn::Batch::batch_size = 0

◆ dataset

const Dataset* opennn::Batch::dataset = nullptr

◆ decoder

BatchSlot opennn::Batch::decoder

◆ device_gather

optional<DeviceGather> opennn::Batch::device_gather

◆ fp32_staging

Buffer opennn::Batch::fp32_staging {Device::CUDA}

◆ gather_indices_device

Buffer opennn::Batch::gather_indices_device {Device::CUDA}

◆ gather_indices_host

device::PinnedBuffer opennn::Batch::gather_indices_host

◆ h2d_done_event

device::CudaEvent opennn::Batch::h2d_done_event

◆ h2d_done_recorded

bool opennn::Batch::h2d_done_recorded = false

◆ input

BatchSlot opennn::Batch::input

◆ input_host_bf16

device::PinnedBuffer opennn::Batch::input_host_bf16

◆ input_views_cache

vector<TensorView> opennn::Batch::input_views_cache

◆ input_views_host_cache

vector<TensorView> opennn::Batch::input_views_host_cache

◆ target

BatchSlot opennn::Batch::target

◆ target_view_cache

TensorView opennn::Batch::target_view_cache

◆ target_view_host_cache

TensorView opennn::Batch::target_view_host_cache