43 void fill(
const vector<Index>&,
47 bool is_training =
true,
48 bool parallelize_samples =
true);
100 void copy_device_async(
const Index,
cudaStream_t,
float* fp32_staging);
Abstract base class for OpenNN datasets, owning samples, variables, and metadata.
Definition dataset.h:61
Definition adaptive_moment_estimation.h:14
bool is_gpu()
Returns true when the resolved configuration runs on a CUDA GPU.
Definition configuration.h:186
void * cudaStream_t
Definition pch.h:82
Index decoder_features_number
Definition batch.h:112
const vector< TensorView > & get_inputs() const
Returns the tensor views over the input buffer (device on GPU mode, host on CPU mode).
Definition batch.h:51
const TensorView & get_targets() const
Returns the tensor view over the target buffer (device on GPU mode, host on CPU mode).
Definition batch.h:60
float * targets_host
Definition batch.h:117
Index inputs_host_allocated_size
Definition batch.h:119
int target_contiguous
Definition batch.h:93
TensorView target_view_host_cache
Definition batch.h:106
Batch(const Index=0, const Dataset *=nullptr)
Constructs a batch sized for samples_number samples drawn from dataset.
Index get_input_elements() const
Definition batch.h:103
Index input_features_number
Definition batch.h:111
Batch & operator=(Batch &&)=delete
void set(const Index=0, const Dataset *=nullptr)
Reconfigures the batch for a new size or dataset; reuses allocations when possible.
Shape input_shape
Definition batch.h:83
vector< TensorView > input_views_host_cache
Definition batch.h:105
Index get_samples_number() const
Returns the current sample count (set by fill(); may be < samples_number).
Buffer decoder
Definition batch.h:85
Batch(const Batch &)=delete
int decoder_contiguous
Definition batch.h:92
int input_contiguous
Definition batch.h:91
bool needs_fp32_staging
Definition batch.h:123
vector< TensorView > input_views_cache
Definition batch.h:108
Shape decoder_shape
Definition batch.h:86
TensorView target_view_cache
Definition batch.h:109
Buffer input
Definition batch.h:82
Index current_sample_count
Definition batch.h:78
Index samples_number
Definition batch.h:77
const Dataset * dataset
Definition batch.h:80
Index decoder_host_allocated_size
Definition batch.h:120
Index target_features_number
Definition batch.h:113
void fill(const vector< Index > &, const vector< Index > &, const vector< Index > &, const vector< Index > &, bool is_training=true, bool parallelize_samples=true)
Loads the indicated samples from the dataset into the batch buffers.
Index targets_host_allocated_size
Definition batch.h:121
Shape target_shape
Definition batch.h:89
Batch & operator=(const Batch &)=delete
float * inputs_host
Definition batch.h:115
void print() const
Prints a human-readable summary of the batch shapes and contents.
float * decoder_host
Definition batch.h:116
Buffer target
Definition batch.h:88
bool is_empty() const
Returns true when the batch is uninitialized or holds zero samples.
Owning raw byte buffer that lives on CPU or CUDA memory, with aligned (re)allocation.
Definition tensor_utilities.h:166
Fixed-capacity small-vector describing tensor dimensions (rank up to MaxRank).
Definition tensor_utilities.h:42
Non-owning view over a tensor: pointer, shape, and data type with rich reshape helpers.
Definition tensor_utilities.h:293