ONE - On-device Neural Engine
|
Public Member Functions | |
None | __init__ (self, Union[List[np.ndarray], np.ndarray, str] input_dataset, Union[List[np.ndarray], np.ndarray, str] expected_dataset, int batch_size, Optional[Tuple[int,...]] input_shape=None, Optional[Tuple[int,...]] expected_shape=None, Any dtype=np.float32) |
Iterator[Tuple[List[np.ndarray], List[np.ndarray]]] | __iter__ (self) |
Tuple[List[np.ndarray], List[np.ndarray]] | __next__ (self) |
Tuple["DataLoader", "DataLoader"] | split (self, float validation_split) |
Data Fields | |
batched_inputs | |
batched_expecteds | |
num_samples | |
batch_size | |
index | |
Protected Member Functions | |
List[np.ndarray] | _process_dataset (self, Union[List[np.ndarray], np.ndarray, str] data, Optional[Tuple[int,...]] shape, Any dtype=np.float32) |
np.ndarray | _load_data (self, str file_path, Optional[Tuple[int,...]] shape, Any dtype=np.float32) |
np.ndarray | _load_raw (self, str file_path, Tuple[int,...] shape, Any dtype) |
Tuple[List[List[np.ndarray]], List[List[np.ndarray]]] | _create_batches (self) |
A flexible DataLoader to manage training and validation data. Automatically detects whether inputs are paths or NumPy arrays.
Definition at line 6 of file dataloader.py.
None package.experimental.train.dataloader.DataLoader.__init__ | ( | self, | |
Union[List[np.ndarray], np.ndarray, str] | input_dataset, | ||
Union[List[np.ndarray], np.ndarray, str] | expected_dataset, | ||
int | batch_size, | ||
Optional[Tuple[int, ...]] | input_shape = None , |
||
Optional[Tuple[int, ...]] | expected_shape = None , |
||
Any | dtype = np.float32 |
||
) |
Initialize the DataLoader. Args: input_dataset (list of np.ndarray | np.ndarray | str): List of input arrays where each array's first dimension is the batch dimension, or a single NumPy array, or a file path. expected_dataset (list of np.ndarray | np.ndarray | str): List of expected arrays where each array's first dimension is the batch dimension, or a single NumPy array, or a file path. batch_size (int): Number of samples per batch. input_shape (tuple[int, ...], optional): Shape of the input data if raw format is used. expected_shape (tuple[int, ...], optional): Shape of the expected data if raw format is used. dtype (type, optional): Data type of the raw file (default: np.float32).
Definition at line 11 of file dataloader.py.
References package.experimental.train.dataloader.DataLoader._process_dataset(), luci_interpreter_pal::lstm_internal::LstmSizeInfo.batch_size, onert_micro::OMTrainingContext.batch_size, nnfw_train_info.batch_size, package.experimental.train.dataloader.DataLoader.batch_size, package.experimental.train.dataloader.DataLoader.batched_inputs, Operation.inputs, Request.inputs, circlechef::CircleImport.inputs(), crew::Part.inputs, luci::CircleReader.inputs(), luci::PGroup.inputs, luci::pass::Expression.inputs, mio::circle::Reader.inputs(), moco::ModelSignature.inputs(), tflinspect::Reader.inputs(), tflchef::TFliteImport.inputs(), tflread::Reader.inputs(), luci_interpreter::CircleReader.inputs(), onert_micro::core::reader::OMCircleReader.inputs(), moco::tf::test::TFNodeBuildTester.inputs(), moco::test::TFNodeBuildTester.inputs(), moco::test::TFNodeBuildTester.inputs(), luci::CircleFakeQuant.inputs(), moco::TFFakeQuantWithMinMaxVars.inputs(), luci::CircleAddN.inputs(), luci::CircleCustom.inputs(), luci::CircleAddN.inputs(), luci::CircleCustom.inputs(), loco::Graph.inputs(), nnc::sir::CallFunction.inputs, nnkit::support::onnx::Runner.inputs(), ann::Operation.inputs(), loco::Graph.inputs(), luci::CircleFakeQuant.inputs(), moco::TFFakeQuantWithMinMaxVars.inputs(), validate_onnx2circle.OnnxRunner.inputs, onert_micro::execute::OMRuntimeKernel.inputs, nnfw_custom_kernel_params.inputs, package.common.basesession.BaseSession.inputs, onert::exec::IODescription.inputs, and package.experimental.train.dataloader.DataLoader.num_samples.
Iterator[Tuple[List[np.ndarray], List[np.ndarray]]] package.experimental.train.dataloader.DataLoader.__iter__ | ( | self | ) |
Make the DataLoader iterable. Returns: self
Definition at line 190 of file dataloader.py.
Tuple[List[np.ndarray], List[np.ndarray]] package.experimental.train.dataloader.DataLoader.__next__ | ( | self | ) |
Return the next batch of data. Returns: tuple: (inputs, expecteds) for the next batch.
Definition at line 200 of file dataloader.py.
References package.experimental.train.dataloader.DataLoader.batched_expecteds, package.experimental.train.dataloader.DataLoader.batched_inputs, luci::GraphBuilderMultiOutput::BuildOutArgs.index, flatbuffers::Definition.index, nnfw::misc::tensor::Diff< T >.index, package.experimental.train.dataloader.DataLoader.index, onert::ir::train::TrainingIndex< T >.index(), onert::exec::Job.index(), loco::Pull.index(), loco::Push.index(), luci::CircleInput.index(), luci::CircleOutput.index(), moco::TFPush.index(), loco::GraphInputIndexQueryService.index(), loco::GraphOutputIndexQueryService.index(), luci::CircleBidirectionalSequenceLSTMOut.index(), luci::CircleCustomOut.index(), luci::CircleIfOut.index(), luci::CircleNonMaxSuppressionV4Out.index(), luci::CircleNonMaxSuppressionV5Out.index(), luci::CircleSplitOut.index(), luci::CircleSplitVOut.index(), luci::CircleTopKV2Out.index(), luci::CircleUniqueOut.index(), luci::CircleUnpackOut.index(), luci::CircleWhileOut.index(), coco::Block.index(), coco::Instr.index(), loco::GraphInput.index(), loco::GraphOutput.index(), loco::Push.index(), loco::Pull.index(), loco::ErrorDetail< ErrorCategory::MissingArgument >.index(), luci::CircleBidirectionalSequenceLSTMOut.index(), luci::CircleCustomOut.index(), luci::CircleIfOut.index(), luci::CircleInput.index(), luci::CircleNonMaxSuppressionV4Out.index(), luci::CircleNonMaxSuppressionV5Out.index(), luci::CircleOutput.index(), luci::CircleSplitOut.index(), luci::CircleSplitVOut.index(), luci::CircleTopKV2Out.index(), luci::CircleUniqueOut.index(), luci::CircleUnpackOut.index(), luci::CircleWhileOut.index(), moco::TFPush.index(), moco::GraphInputIndexAnnotation.index(), and nnfw::misc::tensor::IndexFormatter.index().
|
protected |
Precompute batches for inputs and expected outputs. Returns: tuple: Lists of batched inputs and batched expecteds.
Definition at line 149 of file dataloader.py.
|
protected |
Load data from a file, supporting both .npy and raw formats. Args: file_path (str): Path to the file to load. shape (tuple[int, ...], optional): Shape of the data if raw format is used. dtype (type, optional): Data type of the raw file (default: np.float32). Returns: np.ndarray: Loaded data as a NumPy array.
Definition at line 83 of file dataloader.py.
References package.experimental.train.dataloader.DataLoader._load_raw().
Referenced by package.experimental.train.dataloader.DataLoader._process_dataset().
|
protected |
Load raw binary data. Args: file_path (str): Path to the raw binary file. shape (tuple[int, ...]): Shape of the data to reshape into. dtype (type): Data type of the binary file. Returns: np.ndarray: Loaded data as a NumPy array.
Definition at line 111 of file dataloader.py.
Referenced by package.experimental.train.dataloader.DataLoader._load_data().
|
protected |
Process a dataset or file path. Args: data (str | np.ndarray | list[np.ndarray]): Path to file or NumPy arrays. shape (tuple[int, ...], optional): Shape of the data if raw format is used. dtype (type, optional): Data type for raw files. Returns: list[np.ndarray]: Loaded or passed data as NumPy arrays.
Definition at line 49 of file dataloader.py.
References package.experimental.train.dataloader.DataLoader._load_data().
Referenced by package.experimental.train.dataloader.DataLoader.__init__().
Tuple["DataLoader", "DataLoader"] package.experimental.train.dataloader.DataLoader.split | ( | self, | |
float | validation_split | ||
) |
Split the data into training and validation sets. Args: validation_split (float): Ratio of validation data. Must be between 0.0 and 1.0. Returns: tuple: Two DataLoader instances, one for training and one for validation.
Definition at line 217 of file dataloader.py.
References luci_interpreter_pal::lstm_internal::LstmSizeInfo.batch_size, onert_micro::OMTrainingContext.batch_size, nnfw_train_info.batch_size, package.experimental.train.dataloader.DataLoader.batch_size, Operation.inputs, Request.inputs, circlechef::CircleImport.inputs(), crew::Part.inputs, luci::CircleReader.inputs(), mio::circle::Reader.inputs(), moco::ModelSignature.inputs(), tflinspect::Reader.inputs(), tflchef::TFliteImport.inputs(), tflread::Reader.inputs(), luci_interpreter::CircleReader.inputs(), onert_micro::core::reader::OMCircleReader.inputs(), moco::tf::test::TFNodeBuildTester.inputs(), moco::test::TFNodeBuildTester.inputs(), moco::test::TFNodeBuildTester.inputs(), luci::CircleFakeQuant.inputs(), moco::TFFakeQuantWithMinMaxVars.inputs(), luci::CircleAddN.inputs(), luci::CircleCustom.inputs(), luci::CircleAddN.inputs(), luci::CircleCustom.inputs(), loco::Graph.inputs(), nnkit::support::onnx::Runner.inputs(), ann::Operation.inputs(), loco::Graph.inputs(), luci::CircleFakeQuant.inputs(), luci::PGroup.inputs, luci::pass::Expression.inputs, moco::TFFakeQuantWithMinMaxVars.inputs(), nnc::sir::CallFunction.inputs, validate_onnx2circle.OnnxRunner.inputs, onert_micro::execute::OMRuntimeKernel.inputs, nnfw_custom_kernel_params.inputs, package.common.basesession.BaseSession.inputs, and onert::exec::IODescription.inputs.
package.experimental.train.dataloader.DataLoader.batch_size |
Definition at line 159 of file dataloader.py.
Referenced by package.experimental.train.dataloader.DataLoader.__init__(), and package.experimental.train.dataloader.DataLoader.split().
package.experimental.train.dataloader.DataLoader.batched_expecteds |
Definition at line 47 of file dataloader.py.
Referenced by package.experimental.train.dataloader.DataLoader.__next__().
package.experimental.train.dataloader.DataLoader.batched_inputs |
Definition at line 47 of file dataloader.py.
Referenced by package.experimental.train.dataloader.DataLoader.__init__(), and package.experimental.train.dataloader.DataLoader.__next__().
package.experimental.train.dataloader.DataLoader.index |
Definition at line 197 of file dataloader.py.
Referenced by package.experimental.train.dataloader.DataLoader.__next__().
package.experimental.train.dataloader.DataLoader.num_samples |
Definition at line 159 of file dataloader.py.
Referenced by package.experimental.train.dataloader.DataLoader.__init__().