| AIfES 2 2.0.0

ailayer_reshape.h
Go to the documentation of this file.
1
31 #ifndef AILAYER_RESHAPE_H
32 #define AILAYER_RESHAPE_H
33
34 #include "core/aifes_core.h"
35
36 typedef struct ailayer_reshape ailayer_reshape_t;
37 typedef struct ailayer_flatten ailayer_flatten_t;
38
42 struct ailayer_reshape {
43 ailayer_t base;
51 uint8_t output_dim;
52 uint8_t infer_axis;
53 uint16_t *output_shape;
55
60
69 void (*reshape)(const aitensor_t *x, aitensor_t *result);
70
72 };
73
78 struct ailayer_flatten {
79 ailayer_reshape_t base;
81 uint16_t output_shape[2];
82 };
83
89 extern const aicore_layertype_t *ailayer_reshape_type;
90
102 ailayer_t *ailayer_reshape(ailayer_reshape_t *layer, ailayer_t *input_layer);
103
119 void ailayer_reshape_forward(ailayer_t *self);
120
136 void ailayer_reshape_backward(ailayer_t *self);
137
146 void ailayer_reshape_calc_result_shape(ailayer_t *self);
147
148 #ifdef AIDEBUG_PRINT_MODULE_SPECS
153 void ailayer_reshape_print_specs(const ailayer_t *self);
154 #endif // AIDEBUG_PRINT_MODULE_SPECS
155
156 #endif // AILAYER_RESHAPE_H
aifes_core.h
AIfES 2 core interface.
ailayer_reshape_calc_result_shape
void ailayer_reshape_calc_result_shape(ailayer_t *self)
Calculate the shape of the result tensor (ailayer.result)
ailayer_reshape_type
const aicore_layertype_t * ailayer_reshape_type
Reshape layer type.
ailayer_reshape_backward
void ailayer_reshape_backward(ailayer_t *self)
Calculate the backward pass for given Reshape layer.
ailayer_reshape_forward
void ailayer_reshape_forward(ailayer_t *self)
Calculate the forward pass for given Reshape layer.
ailayer_reshape
ailayer_t * ailayer_reshape(ailayer_reshape_t *layer, ailayer_t *input_layer)
Initialize and connect the given Reshape layer.
ailayer_reshape_print_specs
void ailayer_reshape_print_specs(const ailayer_t *self)
Print the layer specification.
aicore_layertype
Type indicator of the layer.
Definition: aifes_core.h:82
ailayer_flatten
Structure of the Flatten layer, based on the reshape layer .
Definition: ailayer_reshape.h:78
ailayer_flatten::base
ailayer_reshape_t base
Inherited field members from reshape layer struct.
Definition: ailayer_reshape.h:79
ailayer_flatten::output_shape
uint16_t output_shape[2]
Target 2D shape for flatten operation.
Definition: ailayer_reshape.h:81
ailayer_reshape
General layer structure.
Definition: ailayer_reshape.h:42
ailayer_reshape::infer_axis
uint8_t infer_axis
Specifies the axis that is inferred from the elements of the tensor and remaining axes (Set to zero i...
Definition: ailayer_reshape.h:52
ailayer_reshape::reshape
void(* reshape)(const aitensor_t *x, aitensor_t *result)
Optional math function: Reshape.
Definition: ailayer_reshape.h:69
ailayer_reshape::output_dim
uint8_t output_dim
Output dimension count (length of output shape array).
Definition: ailayer_reshape.h:51
ailayer_reshape::base
ailayer_t base
Inherited field members from general ailayer struct.
Definition: ailayer_reshape.h:43
ailayer_reshape::output_shape
uint16_t * output_shape
Target shape for reshape operation.
Definition: ailayer_reshape.h:53
ailayer
AIfES layer interface.
Definition: aifes_core.h:252
aitensor
A tensor in AIfES.
Definition: aifes_math.h:89