Skip to content

morapi_DnnLayerCB Struct Reference

dnn

Callback functions for dnn layer.
More...

#include <morapi_softneuro.h>

Public Types

typedef void *(*  morapi_Create_DnnLayerCB) (morapi_Env *env)
typedef morapi_Result(*  morapi_Destroy_DnnLayerCB) (morapi_Env *env, void *self)
typedef const morapi_Char *(*  morapi_DnnLayerCB_GetDefaultParams) (void *self)
typedef morapi_Result(*  morapi_DnnLayerCB_Init) (void *self, morapi_DnnLayer *i_layer)
typedef morapi_Result(*  morapi_DnnLayerCB_Cleanup) (void *self)
typedef morapi_Result(*  morapi_DnnLayerCB_OptimizeWeight) (void *self, morapi_Tensors *o_optimized, const morapi_Char *i_weight_name, const morapi_Char *i_format)

Public Member Functions

morapi_Result  morapi_DnnLayerCB_clear (morapi_DnnLayerCB *self)

Data Fields

morapi_Create_DnnLayerCB  create
morapi_Destroy_DnnLayerCB  destroy
morapi_DnnLayerCB_GetDefaultParams  get_default_params
morapi_DnnLayerCB_Init  init
morapi_DnnLayerCB_Cleanup  cleanup
morapi_DnnLayerCB_OptimizeWeight  optimize_weight


Detailed Description

Callback functions for dnn layer.


Member Typedef Documentation


morapi_Create_DnnLayerCB

typedef void*(* morapi_Create_DnnLayerCB) (morapi_Env *env)

Creates a layer object.

Parameters

  • env : environment where the object will be created


morapi_Destroy_DnnLayerCB

typedef morapi_Result(* morapi_Destroy_DnnLayerCB) (morapi_Env *env, void *self)

Destroys the layer object.

Parameters

  • env : environment where the object was created
  • self : layer callback object


morapi_DnnLayerCB_GetDefaultParams

typedef const morapi_Char*(* morapi_DnnLayerCB_GetDefaultParams) (void *self)

Gets the default parameters.

Parameters

  • self : layer callback object


morapi_DnnLayerCB_Init

typedef morapi_Result(* morapi_DnnLayerCB_Init) (void *self, morapi_DnnLayer *i_layer)

Initializes the layer object.

In this function, do the following: (1) get input and weight tensors and set them as member variables. (2) parse layer parameters (morapi_DnnLayer_getParams()) and set them as member variables. (3) decide shapes of output tensors, enable them by morapi_DnnLayer_enableOutputTensor() and set them as member varialbes. (4) set the number of operations by morapi_DnnLayer_setOps(). (5) set inplace by morapi_DnnLayer_setInplace() if necessary.

Parameters

  • self : layer callback object
  • self : layer object


morapi_DnnLayerCB_Cleanup

typedef morapi_Result(* morapi_DnnLayerCB_Cleanup) (void *self)

Cleans up the layer object.

Parameters

  • self : layer callback object


morapi_DnnLayerCB_OptimizeWeight

typedef morapi_Result(* morapi_DnnLayerCB_OptimizeWeight) (void *self, morapi_Tensors *o_optimized, const morapi_Char *i_weight_name, const morapi_Char *i_format)

Optimizes a weight.

Parameters

  • self : layer callback object
  • o_optimized : output optimized tensors
  • i_weight_name : weight to be optimized
  • i_format : optimization format

Member Function Documentation


morapi_DnnLayerCB_clear()

morapi_Result morapi_DnnLayerCB_clear (morapi_DnnLayerCB * self)

Clears the callback functions for a dnn layer.

Parameters

  • self : layer callback object

Field Documentation


create

morapi_Create_DnnLayerCB create

creates a layer object.


destroy

morapi_Destroy_DnnLayerCB destroy

destroys the layer object.


get_default_params

morapi_DnnLayerCB_GetDefaultParams get_default_params

gets the default parameters.


init

morapi_DnnLayerCB_Init init

initializes the layer object.


cleanup

morapi_DnnLayerCB_Cleanup cleanup

cleans up the layer object.


optimize_weight

morapi_DnnLayerCB_OptimizeWeight optimize_weight

optimizes a weight.