Doxygen Book
nnstreamer_plugin_api_trainer.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-2.1-only */
14 #ifndef __NNS_PLUGIN_API_TRAINER_H__
15 #define __NNS_PLUGIN_API_TRAINER_H__
16 
17 #include "tensor_typedef.h"
18 
19 #define GST_TENSOR_TRAINER_FRAMEWORK_BASE (0xDEAFDEAD00000000ULL)
20 #define GST_TENSOR_TRAINER_FRAMEWORK_V1 (GST_TENSOR_TRAINER_FRAMEWORK_BASE | 0x10000ULL)
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
32 {
34  const char *model_config;
35  const char *model_save_path;
36  const char *model_load_path;
37  unsigned int num_inputs;
38  unsigned int num_labels;
39  unsigned int num_training_samples;
40  unsigned int num_validation_samples;
41  unsigned int num_epochs;
43  unsigned int epoch_count;
44  double training_loss;
46  double validation_loss;
49 
56 {
57  const char *name;
59 
61 
67 typedef enum
68 {
73 
80 {
81  uint64_t version;
82  void *notifier;
87 
96 {
97  uint64_t version;
102  int (*create) (const GstTensorTrainerFramework * self,
103  const GstTensorTrainerProperties * prop, void **private_data);
110  int (*destroy) (const GstTensorTrainerFramework * self,
111  const GstTensorTrainerProperties * prop, void **private_data);
118  int (*start) (const GstTensorTrainerFramework * self,
120  void *private_data);
128  int (*stop) (const GstTensorTrainerFramework * self,
129  const GstTensorTrainerProperties * prop, void **private_data);
136  int (*push_data) (const GstTensorTrainerFramework * self,
138  void *private_data, const GstTensorMemory * input);
147  GstTensorTrainerProperties *prop, void *private_data);
155  const GstTensorTrainerProperties * prop, void *private_data,
165 };
166 
167 /* extern functions for subplugin management, exist in tensor_trainer.c */
175 extern int
177 
184 extern int
186 
194 extern void
197 
198 #ifdef __cplusplus
199 }
200 #endif
201 
202 #endif /* __NNS_PLUGIN_API_TRAINER_H__ */
TRAINER_EVENT_TRAINING_COMPLETION
@ TRAINER_EVENT_TRAINING_COMPLETION
Definition: nnstreamer_plugin_api_trainer.h:70
nnstreamer_trainer_exit
int nnstreamer_trainer_exit(GstTensorTrainerFramework *ttsp)
Trainer's sub-plugin may call this to unregister itself.
Definition: gsttensor_trainer.c:1398
data
svtc_1 data
Definition: gsttensor_if.c:844
_GstTensorTrainerFramework::stop
int(* stop)(const GstTensorTrainerFramework *self, const GstTensorTrainerProperties *prop, void **private_data)
Definition: nnstreamer_plugin_api_trainer.h:128
nnstreamer_trainer_notify_event
void nnstreamer_trainer_notify_event(GstTensorTrainerEventNotifier *notifier, GstTensorTrainerEventType type, void *data)
Trainer's sub-plugin call this to notify event.
Definition: gsttensor_trainer.c:1425
GstTensorsInfo
Internal meta data exchange format for a other/tensors instance.
Definition: tensor_typedef.h:273
prop
GstTensorSrcIIOChannelProperties * prop
DTYPE_UNSIGNED ( .
Definition: gsttensor_srciio.c:110
_GstTensorTrainerProperties::training_loss
double training_loss
Definition: nnstreamer_plugin_api_trainer.h:44
_GstTensorTrainerProperties::num_labels
unsigned int num_labels
Definition: nnstreamer_plugin_api_trainer.h:38
_GstTensorTrainerProperties::validation_loss
double validation_loss
Definition: nnstreamer_plugin_api_trainer.h:46
GstTensorTrainerEventType
GstTensorTrainerEventType
GstTensorTrainer's event type list.
Definition: nnstreamer_plugin_api_trainer.h:67
GstTensorMemory
The unit of each data tensors. It will be used as an input/output tensor of other/tensors.
Definition: tensor_typedef.h:252
GstTensorTrainerFrameworkInfo
struct _GstTensorTrainerFrameworkInfo GstTensorTrainerFrameworkInfo
GstTensorTrainer's subplugin framework related information.
_GstTensorTrainerProperties::model_load_path
const char * model_load_path
Definition: nnstreamer_plugin_api_trainer.h:36
TRAINER_EVENT_EPOCH_COMPLETION
@ TRAINER_EVENT_EPOCH_COMPLETION
Definition: nnstreamer_plugin_api_trainer.h:69
_GstTensorTrainerProperties::training_accuracy
double training_accuracy
Definition: nnstreamer_plugin_api_trainer.h:45
GstTensorTrainerProperties
struct _GstTensorTrainerProperties GstTensorTrainerProperties
GstTensorTrainer's properties for neural network framework (internal data structure)
_GstTensorTrainerProperties::validation_accuracy
double validation_accuracy
Definition: nnstreamer_plugin_api_trainer.h:47
_GstTensorTrainerFramework::start
int(* start)(const GstTensorTrainerFramework *self, const GstTensorTrainerProperties *prop, GstTensorTrainerEventNotifier *notifier, void *private_data)
Definition: nnstreamer_plugin_api_trainer.h:118
_GstTensorTrainerProperties::num_inputs
unsigned int num_inputs
Definition: nnstreamer_plugin_api_trainer.h:37
_GstTensorTrainerFramework
tensor_trainer subplugin definition
Definition: nnstreamer_plugin_api_trainer.h:95
_GstTensorTrainerProperties::num_validation_samples
unsigned int num_validation_samples
Definition: nnstreamer_plugin_api_trainer.h:40
_GstTensorTrainerProperties::num_training_samples
unsigned int num_training_samples
Definition: nnstreamer_plugin_api_trainer.h:39
_GstTensorTrainerProperties::input_meta
GstTensorsInfo input_meta
Definition: nnstreamer_plugin_api_trainer.h:33
_GstTensorTrainerFramework::getStatus
int(* getStatus)(const GstTensorTrainerFramework *self, GstTensorTrainerProperties *prop, void *private_data)
Definition: nnstreamer_plugin_api_trainer.h:146
_GstTensorTrainerFramework::version
uint64_t version
Definition: nnstreamer_plugin_api_trainer.h:97
tensor_typedef.h
Common header file for NNStreamer, the GStreamer plugin for neural networks.
_GstTensorTrainerFrameworkInfo
GstTensorTrainer's subplugin framework related information.
Definition: nnstreamer_plugin_api_trainer.h:55
_GstTensorTrainerProperties::model_save_path
const char * model_save_path
Definition: nnstreamer_plugin_api_trainer.h:35
_GstTensorTrainerProperties::num_epochs
unsigned int num_epochs
Definition: nnstreamer_plugin_api_trainer.h:41
_GstTensorTrainerProperties::model_config
const char * model_config
Definition: nnstreamer_plugin_api_trainer.h:34
_GstTensorTrainerFramework::create
int(* create)(const GstTensorTrainerFramework *self, const GstTensorTrainerProperties *prop, void **private_data)
Definition: nnstreamer_plugin_api_trainer.h:102
_GstTensorTrainerFramework::getFrameworkInfo
int(* getFrameworkInfo)(const GstTensorTrainerFramework *self, const GstTensorTrainerProperties *prop, void *private_data, GstTensorTrainerFrameworkInfo *fw_info)
Definition: nnstreamer_plugin_api_trainer.h:154
_GstTensorTrainerFramework::destroy
int(* destroy)(const GstTensorTrainerFramework *self, const GstTensorTrainerProperties *prop, void **private_data)
Definition: nnstreamer_plugin_api_trainer.h:110
_GstTensorTrainerProperties::epoch_count
unsigned int epoch_count
Definition: nnstreamer_plugin_api_trainer.h:43
_GstTensorTrainerEventNotifier::notifier
void * notifier
Definition: nnstreamer_plugin_api_trainer.h:82
_GstTensorTrainerEventNotifier::version
uint64_t version
Definition: nnstreamer_plugin_api_trainer.h:81
GstTensorTrainerEventNotifier
struct _GstTensorTrainerEventNotifier GstTensorTrainerEventNotifier
GstTensorTrainer's event notifier.
_GstTensorTrainerFramework::push_data
int(* push_data)(const GstTensorTrainerFramework *self, const GstTensorTrainerProperties *prop, void *private_data, const GstTensorMemory *input)
Definition: nnstreamer_plugin_api_trainer.h:136
type
svtc_1 type
Definition: gsttensor_if.c:843
nnstreamer_trainer_probe
int nnstreamer_trainer_probe(GstTensorTrainerFramework *ttsp)
Trainer's sub-plugin should call this function to register itself.
Definition: gsttensor_trainer.c:1371
_GstTensorTrainerEventNotifier
GstTensorTrainer's event notifier.
Definition: nnstreamer_plugin_api_trainer.h:79
_GstTensorTrainerFrameworkInfo::name
const char * name
Definition: nnstreamer_plugin_api_trainer.h:57
_GstTensorTrainerProperties
GstTensorTrainer's properties for neural network framework (internal data structure)
Definition: nnstreamer_plugin_api_trainer.h:31
TRAINER_EVENT_UNKNOWN
@ TRAINER_EVENT_UNKNOWN
Definition: nnstreamer_plugin_api_trainer.h:71