|
OpenNN
Open-source neural networks library
|
Minibatch container holding pinned host/device buffers and views into a Dataset. More...
#include <batch.h>
Public Member Functions | |
| Batch (const Index=0, const Dataset *=nullptr) | |
Constructs a batch sized for samples_number samples drawn from dataset. | |
| ~Batch () | |
| Batch (const Batch &)=delete | |
| Batch & | operator= (const Batch &)=delete |
| Batch (Batch &&)=delete | |
| 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. | |
| 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. | |
| const vector< TensorView > & | get_inputs () const |
| Returns the tensor views over the input buffer (device on GPU mode, host on CPU mode). | |
| const TensorView & | get_targets () const |
| Returns the tensor view over the target buffer (device on GPU mode, host on CPU mode). | |
| Index | get_samples_number () const |
| Returns the current sample count (set by fill(); may be < samples_number). | |
| void | print () const |
| Prints a human-readable summary of the batch shapes and contents. | |
| bool | is_empty () const |
| Returns true when the batch is uninitialized or holds zero samples. | |
| Index | get_input_elements () const |
Public Attributes | |
| Index | samples_number = 0 |
| Index | current_sample_count = 0 |
| const Dataset * | dataset = nullptr |
| Buffer | input |
| Shape | input_shape |
| Buffer | decoder |
| Shape | decoder_shape |
| Buffer | target |
| Shape | target_shape |
| int | input_contiguous = -1 |
| int | decoder_contiguous = -1 |
| int | target_contiguous = -1 |
| vector< TensorView > | input_views_host_cache |
| TensorView | target_view_host_cache |
| vector< TensorView > | input_views_cache |
| TensorView | target_view_cache |
| Index | input_features_number = 0 |
| Index | decoder_features_number = 0 |
| Index | target_features_number = 0 |
| float * | inputs_host = nullptr |
| float * | decoder_host = nullptr |
| float * | targets_host = nullptr |
| Index | inputs_host_allocated_size = 0 |
| Index | decoder_host_allocated_size = 0 |
| Index | targets_host_allocated_size = 0 |
| bool | needs_fp32_staging = false |
Minibatch container holding pinned host/device buffers and views into a Dataset.
| opennn::Batch::Batch | ( | const Index | = 0, |
| const Dataset * | = nullptr ) |
Constructs a batch sized for samples_number samples drawn from dataset.
| samples_number | Maximum number of samples this batch can hold. |
| dataset | Source dataset used to discover variable shapes (non-owning). |
| opennn::Batch::~Batch | ( | ) |
|
delete |
|
delete |
| void opennn::Batch::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.
| sample_indices | Indices of the dataset rows to load. |
| input_indices | Indices of input variables in the dataset. |
| decoder_indices | Indices of decoder-side input variables (may be empty). |
| target_indices | Indices of target variables in the dataset. |
| is_training | Marks the batch as training (controls augmentation/dropout caches). |
| parallelize_samples | If true, copies samples in parallel. |
|
inline |
|
inline |
Returns the tensor views over the input buffer (device on GPU mode, host on CPU mode).
| Index opennn::Batch::get_samples_number | ( | ) | const |
Returns the current sample count (set by fill(); may be < samples_number).
|
inline |
Returns the tensor view over the target buffer (device on GPU mode, host on CPU mode).
| bool opennn::Batch::is_empty | ( | ) | const |
Returns true when the batch is uninitialized or holds zero samples.
| void opennn::Batch::print | ( | ) | const |
Prints a human-readable summary of the batch shapes and contents.
| void opennn::Batch::set | ( | const Index | = 0, |
| const Dataset * | = nullptr ) |
Reconfigures the batch for a new size or dataset; reuses allocations when possible.
| samples_number | Maximum number of samples this batch can hold. |
| dataset | Source dataset used to discover variable shapes (non-owning). |
| Index opennn::Batch::current_sample_count = 0 |
| const Dataset* opennn::Batch::dataset = nullptr |
| Buffer opennn::Batch::decoder |
| int opennn::Batch::decoder_contiguous = -1 |
| Index opennn::Batch::decoder_features_number = 0 |
| float* opennn::Batch::decoder_host = nullptr |
| Index opennn::Batch::decoder_host_allocated_size = 0 |
| Shape opennn::Batch::decoder_shape |
| Buffer opennn::Batch::input |
| int opennn::Batch::input_contiguous = -1 |
| Index opennn::Batch::input_features_number = 0 |
| Shape opennn::Batch::input_shape |
| vector<TensorView> opennn::Batch::input_views_cache |
| vector<TensorView> opennn::Batch::input_views_host_cache |
| float* opennn::Batch::inputs_host = nullptr |
| Index opennn::Batch::inputs_host_allocated_size = 0 |
| bool opennn::Batch::needs_fp32_staging = false |
| Index opennn::Batch::samples_number = 0 |
| Buffer opennn::Batch::target |
| int opennn::Batch::target_contiguous = -1 |
| Index opennn::Batch::target_features_number = 0 |
| Shape opennn::Batch::target_shape |
| TensorView opennn::Batch::target_view_cache |
| TensorView opennn::Batch::target_view_host_cache |
| float* opennn::Batch::targets_host = nullptr |
| Index opennn::Batch::targets_host_allocated_size = 0 |