Skip to content

morapi_Dnn Struct Reference

dnn

Deep neural network.
More...

#include <morapi_softneuro.h>

Public Member Functions


Primary functions

morapi_Dnn morapi_create_Dnn (morapi_Env *io_env)
morapi_Result  morapi_Dnn_initialize (morapi_Dnn *self)
morapi_Result  morapi_Dnn_load (morapi_Dnn *self, const morapi_Char *i_filename, const void *i_pass, morapi_Int32 i_pass_size, morapi_Bool i_is_lazy)
morapi_Int32  morapi_Dnn_getInputNum (const morapi_Dnn *self)
morapi_Tensor morapi_Dnn_getInputBlob (const morapi_Dnn *self, morapi_Int32 i_input_index)
morapi_Result  morapi_Dnn_setInputImage (morapi_Dnn *self, const morapi_Image *i_image, morapi_Int32 i_index, morapi_Int32 i_batch)
morapi_Result  morapi_Dnn_setInputImageWithOptions (morapi_Dnn *self, const morapi_Image *i_image, morapi_Int32 i_index, morapi_Int32 i_batch, morapi_Bool i_keep_ar, morapi_DnnResizeMode i_resize_mode, morapi_Uint8 i_padding_color[3])
morapi_Params morapi_Dnn_getInputAttrs (const morapi_Dnn *self, morapi_Int32 i_input_index)
morapi_Result  morapi_Dnn_forward (morapi_Dnn *self)
morapi_Int32  morapi_Dnn_getOutputNum (const morapi_Dnn *self)
morapi_Params morapi_Dnn_getOutputAttrs (const morapi_Dnn *self, morapi_Int32 i_output_index)
morapi_Tensor morapi_Dnn_getOutputBlob (const morapi_Dnn *self, morapi_Int32 i_output_index)
morapi_Result  morapi_Dnn_save (morapi_Dnn *self, const morapi_Char *o_filename, const void *i_pass, morapi_Int32 i_pass_size, morapi_Bool i_is_secret)
morapi_Result  morapi_destroy_Dnn (morapi_Env *io_env, morapi_Dnn *self)

Optional settings

morapi_Result  morapi_Dnn_setThreadNum (morapi_Dnn *self, morapi_Int32 i_thread_num)
morapi_Int32  morapi_Dnn_getThreadNum (const morapi_Dnn *self)
morapi_Result  morapi_Dnn_setAffinityMask (morapi_Dnn *self, morapi_Int32 i_thread_index, const morapi_Char *i_affinity_mask)
morapi_Int32  morapi_Dnn_getAffinityMaskNum (const morapi_Dnn *self)
const morapi_Char morapi_Dnn_getAffinityMask (morapi_Dnn *self, morapi_Int32 i_thread_index)
morapi_Result  morapi_Dnn_resetThreadNumAndAffinityMask (morapi_Dnn *self)
morapi_Result  morapi_Dnn_setBoosted (morapi_Dnn *self, morapi_Bool i_is_boosted)
morapi_Bool  morapi_Dnn_isBoosted (const morapi_Dnn *self)
morapi_Result  morapi_Dnn_setBatchSize (morapi_Dnn *self, morapi_Int32 i_batch_size)
morapi_Int32  morapi_Dnn_getBatchSize (const morapi_Dnn *self)
morapi_Result  morapi_Dnn_setInputShape (morapi_Dnn *self, morapi_Int32 i_input_index, morapi_Int32 i_rank, const morapi_Int32 *i_shape)
morapi_Result  morapi_Dnn_setBufOptEnabled (morapi_Dnn *self, const morapi_Device *i_device, morapi_Bool i_is_enabled)
morapi_Bool  morapi_Dnn_isBufOptEnabled (const morapi_Dnn *self, const morapi_Device *i_device)
morapi_Result  morapi_Dnn_setDumpEnabled (morapi_Dnn *self, morapi_Bool i_is_dump_enabled)
morapi_Bool  morapi_Dnn_isDumpEnabled (const morapi_Dnn *self)
morapi_Result  morapi_Dnn_setDumpDir (morapi_Dnn *self, const morapi_Char *i_dump_dir)
morapi_Result  morapi_Dnn_setModelText (morapi_Dnn *self, const morapi_Char *i_text)
morapi_Int32  morapi_Dnn_getModelTextSize (morapi_Dnn *self)
morapi_Result  morapi_Dnn_getModelText (morapi_Dnn *self, morapi_Char *o_text, morapi_Int32 i_text_size)

Tensor operations

morapi_Tensor morapi_Dnn_addTensor (morapi_Dnn *self, const morapi_Char *i_name)
morapi_Result  morapi_Dnn_removeTensor (morapi_Dnn *self, morapi_Tensor *io_tensor)
morapi_Int32  morapi_Dnn_getTensorNum (const morapi_Dnn *self)
morapi_Tensor morapi_Dnn_getTensor (const morapi_Dnn *self, morapi_Int32 i_index)
morapi_Tensor morapi_Dnn_findTensor (const morapi_Dnn *self, const morapi_Char *i_name)

Net operations

morapi_Int32  morapi_Dnn_getNetNum (const morapi_Dnn *self)
morapi_DnnNet morapi_Dnn_getNet (const morapi_Dnn *self, morapi_Int32 i_index)
morapi_DnnNet morapi_Dnn_findMainNet (const morapi_Dnn *self)
morapi_DnnNet morapi_Dnn_addNet (morapi_Dnn *self, const morapi_Char *i_name)
morapi_Result  morapi_Dnn_removeNet (morapi_Dnn *self, morapi_DnnNet *io_net)
morapi_DnnNet morapi_Dnn_findNet (const morapi_Dnn *self, const morapi_Char *i_name)

Other functions

morapi_Result  morapi_Dnn_parse (morapi_Dnn *self)
morapi_Result  morapi_Dnn_compile (morapi_Dnn *self)
morapi_Result  morapi_Dnn_cleanup (morapi_Dnn *self)
morapi_DnnState  morapi_Dnn_getState (const morapi_Dnn *self)
morapi_Bool  morapi_Dnn_isFailed (const morapi_Dnn *self)
morapi_Result  morapi_Dnn_clear (morapi_Dnn *self)
morapi_Bool  morapi_Dnn_isEmpty (const morapi_Dnn *self)
morapi_Result  morapi_Dnn_loadFromMemory (morapi_Dnn *self, morapi_Uint8 *i_model_buf, morapi_Int64 i_model_size)
morapi_Bool  morapi_Dnn_isSecret (const morapi_Dnn *self)
morapi_Bool  morapi_Dnn_isPasswordProtected (const morapi_Dnn *self)
morapi_Bool  morapi_Dnn_isLazy (const morapi_Dnn *self)
morapi_Bool  morapi_Dnn_setBinaryLibEmbedded (morapi_Dnn *self, morapi_Bool i_is_embedded)
morapi_Bool  morapi_Dnn_isBinaryLibEmbedded (const morapi_Dnn *self)
morapi_Result  morapi_Dnn_saveBinaryLib (morapi_Dnn *self, const morapi_Char *i_file_name, morapi_Bool i_saves_only_when_changed)
morapi_Result  morapi_Dnn_loadBinaryLib (morapi_Dnn *self, const morapi_Char *i_file_name)
morapi_Result  morapi_Dnn_tune (morapi_Dnn *self, const morapi_DnnRecipe *i_recipe)
morapi_Bool  morapi_Dnn_isTuned (const morapi_Dnn *self)
const morapi_Params morapi_Dnn_getTuneParams (const morapi_Dnn *self)
morapi_Result  morapi_Dnn_recycle (morapi_Dnn *self)
morapi_Tensor morapi_Dnn_getInput (const morapi_Dnn *self, morapi_Int32 i_input_index)
morapi_Tensor morapi_Dnn_getOutput (const morapi_Dnn *self, morapi_Int32 i_output_index)
morapi_Result  morapi_Dnn_reset (morapi_Dnn *self)
morapi_Result  morapi_Dnn_squashNet (morapi_Dnn *self, morapi_DnnNet *io_net, const morapi_Char *i_name)

morapi_Result  morapi_Dnn_static_installRoutineSchema (morapi_Env *env, const morapi_Char *i_schema)
morapi_Int32  morapi_Dnn_static_getRoutineSchemaNum (morapi_Env *env)
const morapi_Char **  morapi_Dnn_static_getRoutineSchemas (morapi_Env *env)


Detailed Description

Deep neural network.

This structure contains all data needed to operate a dnn.


test_decompose_api.c, test_dnn_api.c, and test_prof_api.c.


Member Function Documentation


morapi_create_Dnn()

morapi_Dnn * morapi_create_Dnn (morapi_Env * io_env)

Creates a Dnn module.

Parameters

  • io_env : the environment data

Returns

the created dnn module


test_decompose_api.c, test_dnn_api.c, and test_prof_api.c.


morapi_Dnn_initialize()

morapi_Result morapi_Dnn_initialize (morapi_Dnn * self)

Initializes the Dnn module.

Parameters

  • self : the dnn.

test_dnn_api.c.


morapi_Dnn_load()

morapi_Result morapi_Dnn_load (morapi_Dnn * self,
                               const morapi_Char * i_filename,
                               const void * i_pass,
                               morapi_Int32 i_pass_size,
                               morapi_Bool i_is_lazy)

Reads the dnn from a file.

Parameters

  • self : the dnn module
  • i_filename : the path of the dnn file
  • i_pass : the password of the dnn file, use NULL for the dnn file without password
  • i_pass_size : the size of the password
  • i_is_lazy : lazy loading or not.

test_decompose_api.c, test_dnn_api.c, and test_prof_api.c.


morapi_Dnn_getInputNum()

morapi_Int32 morapi_Dnn_getInputNum (const morapi_Dnn * self)

Get the number of inputs for Dnn.

Parameters

  • self : the dnn module


morapi_Dnn_getInputBlob()

morapi_Tensor * morapi_Dnn_getInputBlob (const morapi_Dnn * self,
                                         morapi_Int32 i_input_index)

Gets the i_input_index-th input blob.

Valid after compiled.

Parameters

  • self : the dnn module
  • i_input_index : input index


morapi_Dnn_setInputImage()

morapi_Result morapi_Dnn_setInputImage (morapi_Dnn * self,
                                        const morapi_Image * i_image,
                                        morapi_Int32 i_index,
                                        morapi_Int32 i_batch)

Sets an image to the i_batch-th batch of i_input_index-th input.

Uses the dnn input attrs (keep_ar, padding_color, resize_mode) for the resize settings, if available. Defaults to Bilinear resize and doesn't keep image aspect ratio (no padding).

Parameters

  • self : the dnn module
  • i_image : image to be set as input
  • i_index : input index to set the image at
  • i_batch : batch to set the image at

test_dnn_api.c.


morapi_Dnn_setInputImageWithOptions()

morapi_Result morapi_Dnn_setInputImageWithOptions (morapi_Dnn * self,
                                                   const morapi_Image * i_image,
                                                   morapi_Int32 i_index,
                                                   morapi_Int32 i_batch,
                                                   morapi_Bool i_keep_ar,
                                                   morapi_DnnResizeMode i_resize_mode,
                                                   morapi_Uint8 i_padding_color[3])

Sets an image to the i_batch-th batch of i_input_index-th input using the given resize mode and padding to keep aspect ratio if set.

Parameters

  • self : the dnn module
  • i_image : image to be set as input
  • i_index : input index to set the image at
  • i_batch : batch to set the image at
  • i_keep_ar : whether or not to keep aspect ratio if resizing the image
  • i_resize_mode : image resize mode, either MORAPI_DNN_RESIZE_MODE_BILINEAR or MORAPI_DNN_RESIZE_MODE_NEAREST
  • i_padding_color : 0-255 RGB values to use as padding when resizing with keep aspect ratio on, NULL for zero padding


morapi_Dnn_getInputAttrs()

morapi_Params * morapi_Dnn_getInputAttrs (const morapi_Dnn * self,
                                          morapi_Int32 i_input_index)

Gets the i_input_index-th input attributes.

Parameters

  • self : the dnn module
  • i_input_index : input index


morapi_Dnn_forward()

morapi_Result morapi_Dnn_forward (morapi_Dnn * self)

Executes forward propagation once on the network.

Parameters

  • self : the dnn module

test_dnn_api.c.


morapi_Dnn_getOutputNum()

morapi_Int32 morapi_Dnn_getOutputNum (const morapi_Dnn * self)

Gets the number of outputs.

Parameters

  • self : the dnn module


morapi_Dnn_getOutputAttrs()

morapi_Params * morapi_Dnn_getOutputAttrs (const morapi_Dnn * self,
                                           morapi_Int32 i_output_index)

Gets attributes from the i_output_index-th output.

Parameters

  • self : the dnn module
  • i_output_index : output tensor index

Returns

morapi_Params object


test_dnn_api.c.


morapi_Dnn_getOutputBlob()

morapi_Tensor * morapi_Dnn_getOutputBlob (const morapi_Dnn * self,
                                          morapi_Int32 i_output_index)

Gets tensor blob from the i_output_index-th output.

Valid after compiled.

Returns

morapi_Tensor object


test_dnn_api.c.


morapi_Dnn_save()

morapi_Result morapi_Dnn_save (morapi_Dnn * self,
                               const morapi_Char * o_filename,
                               const void * i_pass,
                               morapi_Int32 i_pass_size,
                               morapi_Bool i_is_secret)

Writes the dnn to a file.

It does nothing and returns MORAPI_ERROR_STATE if self is secret.

Parameters

  • self : the dnn module
  • o_filename : output file name
  • i_pass : encryption password, if needed
  • i_pass_size : encryption password size
  • i_is_secret : whether makes the dnn secret or not.

test_decompose_api.c, and test_prof_api.c.


morapi_destroy_Dnn()

morapi_Result morapi_destroy_Dnn (morapi_Env * io_env,
                                  morapi_Dnn * self)

Destroys the Dnn module to free memory.

Parameters

  • io_env : the envitonment data
  • self : the dnn module to be destroyed

test_decompose_api.c, test_dnn_api.c, and test_prof_api.c.


morapi_Dnn_setThreadNum()

morapi_Result morapi_Dnn_setThreadNum (morapi_Dnn * self,
                                       morapi_Int32 i_thread_num)

Sets the number of threads for forward propagation.

It clears affinity masks set by morapi_Dnn_setAffinityMask(). If i_thread_num=0, the number of threads gets equal to the number of logical CPU cores.

Parameters

  • self : the dnn module
  • i_thread_num : number of threads to be used

test_dnn_api.c.


morapi_Dnn_getThreadNum()

morapi_Int32 morapi_Dnn_getThreadNum (const morapi_Dnn * self)

Gets the number of CPU threads for forward propagation.

If 0 is set by morapi_Dnn_setThreadNum(), returns the number of logical CPU cores.

Parameters

  • self : the dnn module


morapi_Dnn_setAffinityMask()

morapi_Result morapi_Dnn_setAffinityMask (morapi_Dnn * self,
                                          morapi_Int32 i_thread_index,
                                          const morapi_Char * i_affinity_mask)

Sets an affinity mask.

Parameters

  • self : the dnn module
  • i_thread_index : thread index for which affinity mask will be set
  • i_affinity_mask : an affinity mask represented in hex ("0x..") or binary ("0b..") form.


morapi_Dnn_getAffinityMaskNum()

morapi_Int32 morapi_Dnn_getAffinityMaskNum (const morapi_Dnn * self)

Gets the number of affinity masks.

Parameters

  • self : the dnn module


morapi_Dnn_getAffinityMask()

const morapi_Char * morapi_Dnn_getAffinityMask (morapi_Dnn * self,
                                                morapi_Int32 i_thread_index)

Gets an affinity mask in hex ("0x..) form.

Parameters

  • self : the dnn module
  • i_thread_index : thread index for which affinity mask will be get


morapi_Dnn_resetThreadNumAndAffinityMask()

morapi_Result morapi_Dnn_resetThreadNumAndAffinityMask (morapi_Dnn * self)

Resets the number of threads and affinity mask to the default.

Parameters

  • self : the dnn module.


morapi_Dnn_setBoosted()

morapi_Result morapi_Dnn_setBoosted (morapi_Dnn * self,
                                     morapi_Bool i_is_boosted)

Sets boosted multi-threads (MORAPI_TRUE) or not (MORAPI_FALSE).

Boosted multi-thread mode allows to 'busy wait' the other threads. The default is MORAPI_TRUE.

Parameters

  • self : the dnn module
  • i_is_boosted : whether boosted or not.


morapi_Dnn_isBoosted()

morapi_Bool morapi_Dnn_isBoosted (const morapi_Dnn * self)

Gets whether boosted multi-thread mode or not.

Parameters

  • self : the dnn module

Returns

whether boosted or not.


morapi_Dnn_setBatchSize()

morapi_Result morapi_Dnn_setBatchSize (morapi_Dnn * self,
                                       morapi_Int32 i_batch_size)

Sets the batch size for forward propagation.

Parameters

  • self : the dnn module
  • i_batch_size : batch size

test_dnn_api.c.


morapi_Dnn_getBatchSize()

morapi_Int32 morapi_Dnn_getBatchSize (const morapi_Dnn * self)

Gets the batch size for forward propagation.

Parameters

  • self : the dnn module


morapi_Dnn_setInputShape()

morapi_Result morapi_Dnn_setInputShape (morapi_Dnn * self,
                                        morapi_Int32 i_input_index,
                                        morapi_Int32 i_rank,
                                        const morapi_Int32 * i_shape)

Sets the i_input_index-th input shape.

Parameters

  • self : the dnn module
  • i_input_index : input index
  • i_rank : input rank
  • i_shape : shape to be set


morapi_Dnn_setBufOptEnabled()

morapi_Result morapi_Dnn_setBufOptEnabled (morapi_Dnn * self,
                                           const morapi_Device * i_device,
                                           morapi_Bool i_is_enabled)

Enables or disables buffer optimization.

Buffer optimization reduces memory usage during forward propagation.

Parameters

  • self : the dnn module
  • i_device : device for which buffer optimization will be enabled/disabled
  • i_is_enabled : boolean indicating whether it will be enabled (true) or disabled (false)


morapi_Dnn_isBufOptEnabled()

morapi_Bool morapi_Dnn_isBufOptEnabled (const morapi_Dnn * self,
                                        const morapi_Device * i_device)

Returns whether buffer optimization is enabled or not.

Parameters

  • self : the dnn module
  • i_device : device to be checked


morapi_Dnn_setDumpEnabled()

morapi_Result morapi_Dnn_setDumpEnabled (morapi_Dnn * self,
                                         morapi_Bool i_is_dump_enabled)

Enables or disables data dump of layer outputs by morapi_Dnn_dump().

Precondition

Call this before morapi_Dnn_compile(). This method automatically uncompiles if already compiled.

Parameters

  • self : the dnn module
  • i_is_dump_enabled : false to disable dump, true to enable it


morapi_Dnn_isDumpEnabled()

morapi_Bool morapi_Dnn_isDumpEnabled (const morapi_Dnn * self)

Returns whether data dump is enabled or not.

Parameters

  • self : the dnn module


morapi_Dnn_setDumpDir()

morapi_Result morapi_Dnn_setDumpDir (morapi_Dnn * self,
                                     const morapi_Char * i_dump_dir)

Sets the dump directory.

If NULL or empty, no file is dumped.

Parameters

  • self : the dnn module
  • i_dump_dir : dump directory


morapi_Dnn_setModelText()

morapi_Result morapi_Dnn_setModelText (morapi_Dnn * self,
                                       const morapi_Char * i_text)

Sets the model text.

Parameters

  • self : the dnn module
  • i_text : text to be set


morapi_Dnn_getModelTextSize()

morapi_Int32 morapi_Dnn_getModelTextSize (morapi_Dnn * self)

Gets the length of JSON text data for the Dnn network structure.

Parameters

  • self : the dnn module


morapi_Dnn_getModelText()

morapi_Result morapi_Dnn_getModelText (morapi_Dnn * self,
                                       morapi_Char * o_text,
                                       morapi_Int32 i_text_size)

Gets the JSON text data for Dnn network structure.

Parameters

  • self : the dnn module
  • o_text : output model text
  • i_text_size : text size


morapi_Dnn_addTensor()

morapi_Tensor * morapi_Dnn_addTensor (morapi_Dnn * self,
                                      const morapi_Char * i_name)

Adds a new tensor to the Dnn module.

Parameters

  • self : the dnn module
  • i_name : tensor name


morapi_Dnn_removeTensor()

morapi_Result morapi_Dnn_removeTensor (morapi_Dnn * self,
                                       morapi_Tensor * io_tensor)

Removes the tensor from the Dnn.

Parameters

  • self : the dnn module
  • io_tensor : tensor to be removed


morapi_Dnn_getTensorNum()

morapi_Int32 morapi_Dnn_getTensorNum (const morapi_Dnn * self)

Gets the number of named tensors stored in the Dnn.

Parameters

  • self : the dnn module


morapi_Dnn_getTensor()

morapi_Tensor * morapi_Dnn_getTensor (const morapi_Dnn * self,
                                      morapi_Int32 i_index)

Gets the i_index-th named tensor in the Dnn.

Parameters

  • self : the dnn module
  • i_index : tensor index


morapi_Dnn_findTensor()

morapi_Tensor * morapi_Dnn_findTensor (const morapi_Dnn * self,
                                       const morapi_Char * i_name)

Finds a tensor in the Dnn by name.

Parameters

  • self : the dnn module
  • i_name : tensor name


morapi_Dnn_getNetNum()

morapi_Int32 morapi_Dnn_getNetNum (const morapi_Dnn * self)

Gets the number of DnnNet subnetworks in the Dnn.

Parameters

  • self : the dnn module

Returns

the number of DnnNet


test_dnn_api.c.


morapi_Dnn_getNet()

morapi_DnnNet * morapi_Dnn_getNet (const morapi_Dnn * self,
                                   morapi_Int32 i_index)

Gets the i_index-th DnnNet subnetwork in the Dnn.

Parameters

  • self : the dnn module
  • i_index : net index

Returns

the i_index-th DnnNet


test_dnn_api.c.


morapi_Dnn_findMainNet()

morapi_DnnNet * morapi_Dnn_findMainNet (const morapi_Dnn * self)

Finds the main subnetwork in the Dnn.

Parameters

  • self : the dnn module

Returns

the biggest subnetwork


test_decompose_api.c.


morapi_Dnn_addNet()

morapi_DnnNet * morapi_Dnn_addNet (morapi_Dnn * self,
                                   const morapi_Char * i_name)

Adds a net.

Parameters

  • self : the dnn module
  • i_name : net name

Returns

the resulted DnnNet module


morapi_Dnn_removeNet()

morapi_Result morapi_Dnn_removeNet (morapi_Dnn * self,
                                    morapi_DnnNet * io_net)

Removes the net.

Parameters

  • self : the dnn module
  • io_net : net to be removed

test_decompose_api.c.


morapi_Dnn_findNet()

morapi_DnnNet * morapi_Dnn_findNet (const morapi_Dnn * self,
                                    const morapi_Char * i_name)

Finds the net named i_name.

Parameters

  • self : the dnn module
  • i_name : name of the net to be found

Returns

pointer to the DnnNet module


morapi_Dnn_parse()

morapi_Result morapi_Dnn_parse (morapi_Dnn * self)

Parses the dnn.

Parameters

  • self : the dnn module


morapi_Dnn_compile()

morapi_Result morapi_Dnn_compile (morapi_Dnn * self)

Compiles the dnn to run forward propagation.

Parameters

  • self : the dnn module

test_dnn_api.c.


morapi_Dnn_cleanup()

morapi_Result morapi_Dnn_cleanup (morapi_Dnn * self)

Cleans up.

Parameters

  • self : the dnn module to be cleaned up


morapi_Dnn_getState()

morapi_DnnState morapi_Dnn_getState (const morapi_Dnn * self)

Gets the state.

Parameters

  • self : the dnn module


morapi_Dnn_isFailed()

morapi_Bool morapi_Dnn_isFailed (const morapi_Dnn * self)

Returns whether self is failed or not.

Parameters

  • self : the dnn module


morapi_Dnn_clear()

morapi_Result morapi_Dnn_clear (morapi_Dnn * self)

Removes all tensors and nets.

Parameters

  • self : the dnn module


morapi_Dnn_isEmpty()

morapi_Bool morapi_Dnn_isEmpty (const morapi_Dnn * self)

Returns whether self is empty or not.


morapi_Dnn_loadFromMemory()

morapi_Result morapi_Dnn_loadFromMemory (morapi_Dnn * self,
                                         morapi_Uint8 * i_model_buf,
                                         morapi_Int64 i_model_size)

load the dnn from memory.

Parameters

  • self : the dnn module
  • i_model_buf : input model buffer
  • i_model_size : input model size


morapi_Dnn_isSecret()

morapi_Bool morapi_Dnn_isSecret (const morapi_Dnn * self)

Returns whether the dnn is secret or not.

Parameters

  • self : the dnn module


morapi_Dnn_isPasswordProtected()

morapi_Bool morapi_Dnn_isPasswordProtected (const morapi_Dnn * self)

Returns whether self is password-protected or not.


morapi_Dnn_isLazy()

morapi_Bool morapi_Dnn_isLazy (const morapi_Dnn * self)

Returns whether the dnn is lazy loaded or not.

Parameters

  • self : the dnn module


morapi_Dnn_setBinaryLibEmbedded()

morapi_Bool morapi_Dnn_setBinaryLibEmbedded (morapi_Dnn * self,
                                             morapi_Bool i_is_embedded)

Sets whether the binary lib is embedded when serialization.

Parameters

  • self : the dnn object.
  • i_is_embedded : whether the binary lib is embedded or not.


morapi_Dnn_isBinaryLibEmbedded()

morapi_Bool morapi_Dnn_isBinaryLibEmbedded (const morapi_Dnn * self)

Returns whether the binary lib is embedded when serialization.

Parameters

  • self : the dnn object.


morapi_Dnn_saveBinaryLib()

morapi_Result morapi_Dnn_saveBinaryLib (morapi_Dnn * self,
                                        const morapi_Char * i_file_name,
                                        morapi_Bool i_saves_only_when_changed)

Saves the binary lib to a file.

Parameters

  • self : the dnn object.
  • i_file_name : the file name.
  • i_saves_only_when_changed : whether to save the binary library only when it is changed.


morapi_Dnn_loadBinaryLib()

morapi_Result morapi_Dnn_loadBinaryLib (morapi_Dnn * self,
                                        const morapi_Char * i_file_name)

Loads the binary lib from a file.


morapi_Dnn_tune()

morapi_Result morapi_Dnn_tune (morapi_Dnn * self,
                               const morapi_DnnRecipe * i_recipe)

Tune the dnn by the tuning recipe.

Parameters

  • self : the dnn module
  • i_recipe : tuning recipe

test_prof_api.c.


morapi_Dnn_isTuned()

morapi_Bool morapi_Dnn_isTuned (const morapi_Dnn * self)

Returns whether the dnn is tuned or not.

Parameters

  • self : the dnn module


morapi_Dnn_getTuneParams()

const morapi_Params * morapi_Dnn_getTuneParams (const morapi_Dnn * self)

Gets tuning parameters.


morapi_Dnn_recycle()

morapi_Result morapi_Dnn_recycle (morapi_Dnn * self)

Recycles the dnn by decompiling and unparsing.

Parameters

  • self : the dnn module


morapi_Dnn_getInput()

morapi_Tensor * morapi_Dnn_getInput (const morapi_Dnn * self,
                                     morapi_Int32 i_input_index)

Gets the i_input_index-th input tensor.

Parameters

  • self : the dnn module
  • i_input_index : input tensor index


morapi_Dnn_getOutput()

morapi_Tensor * morapi_Dnn_getOutput (const morapi_Dnn * self,
                                      morapi_Int32 i_output_index)

Gets the i_output_index-th output tensor.

Parameters

  • self : the dnn module
  • i_output_index : output tensor index


morapi_Dnn_reset()

morapi_Result morapi_Dnn_reset (morapi_Dnn * self)

Resets the network state for cases where weights change during execution.

Parameters

  • self : the dnn module


morapi_Dnn_squashNet()

morapi_Result morapi_Dnn_squashNet (morapi_Dnn * self,
                                    morapi_DnnNet * io_net,
                                    const morapi_Char * i_name)

Squashes the net.


test_decompose_api.c.



morapi_Dnn_static_installRoutineSchema()

morapi_Result morapi_Dnn_static_installRoutineSchema (morapi_Env * env,
                                                      const morapi_Char * i_schema)

Installs a routine schema.


morapi_Dnn_static_getRoutineSchemaNum()

morapi_Int32 morapi_Dnn_static_getRoutineSchemaNum (morapi_Env * env)

Gets the number of installed routine schemas.

Parameters

  • env : environment where the routine are installed.


morapi_Dnn_static_getRoutineSchemas()

const morapi_Char ** morapi_Dnn_static_getRoutineSchemas (morapi_Env * env)

Gets the installed routine schemas.

Parameters

  • env : environment where the routines are installed.