
Files | |
| file | noodle_internal.h |
| Private declarations shared by Noodle implementation files. | |
Functions | |
| float * | noodle_temp1_require (size_t required_floats) |
| Ensure temp buffer 1 can hold a number of floats. | |
| float * | noodle_temp2_require (size_t required_floats) |
| Ensure temp buffer 2 can hold a number of floats. | |
| void | noodle_temp_buffers_free (void) |
| Free Noodle-owned scratch buffers and detach external scratch buffers. | |
| float * | noodle_slice (float *flat, size_t W, size_t z) |
| Return a channel plane from a packed [Z][W][W] tensor. | |
| size_t | noodle_read_raw (NDL_File &f, void *dst, size_t n) |
| Read raw bytes from a backend file handle. | |
| size_t | noodle_write_raw (NDL_File &f, const void *src, size_t n) |
| Write raw bytes to a backend file handle. | |
| size_t | noodle_read_float_block (NDL_File &f, float *dst, size_t n_floats) |
| Read a block of floats using the configured scalar file format. | |
| float | noodle_dot_float_block (const float *x, const float *w, uint16_t n) |
| Compute a dot product with a small unrolled loop. | |
| uint16_t | noodle_do_conv1d (float *input, float *kernel, uint16_t W, uint16_t K, float *output, uint16_t P, uint16_t S) |
| Accumulate one 1D convolution into an output sequence. | |
| uint16_t | noodle_do_pooling1d (float *input, uint16_t W, uint16_t K, uint16_t S, const char *fn) |
| Apply valid 1D max pooling and write to a file. | |
| uint16_t | noodle_do_pooling1d (float *input, uint16_t W, uint16_t K, uint16_t S, NDL_File &fo) |
| Apply valid 1D max pooling and write to an open file. | |
| uint16_t | noodle_do_pooling1d (const float *input, uint16_t W, uint16_t K, uint16_t S, float *output) |
| Apply valid 1D pooling and write to memory. | |
| float | noodle_get_padded_x (byte *grid, int16_t i, int16_t j, int16_t W, int16_t P0, int16_t P1) |
| Read a byte grid sample with asymmetric zero padding. | |
| float | noodle_get_padded_x (float *grid, int16_t i, int16_t j, int16_t W, int16_t P0, int16_t P1) |
| Read a float grid sample with asymmetric zero padding. | |
| uint16_t | noodle_do_bias (float *output, float bias, uint16_t n) |
| Add bias to a square output map and apply ReLU. | |
| uint16_t | noodle_do_pooling (const float *input, uint16_t W, uint16_t K, uint16_t S, const char *fn) |
| Apply 2D pooling and write to a file. | |
| uint16_t | noodle_do_pooling (const float *input, uint16_t W, uint16_t K, uint16_t S, NDL_File &fo) |
| Apply 2D pooling and write to an open file. | |
| uint16_t | noodle_do_pooling (const float *input, uint16_t W, uint16_t K, uint16_t S, float *output) |
| Apply 2D pooling and write to memory. | |
| uint16_t | noodle_do_conv (byte *grid, const float *kernel, uint16_t K, uint16_t W, float *output, uint16_t P, uint16_t S) |
| Accumulate one byte-input 2D convolution plane. | |
| uint16_t | noodle_do_conv (float *grid, const float *kernel, uint16_t K, uint16_t W, float *output, uint16_t P, uint16_t S) |
| Accumulate one float-input 2D convolution plane. | |
| void | noodle_reset_buffer (float *buffer, uint16_t n) |
| Clear a float buffer. | |
| uint16_t | noodle_do_bias_act (float *output, float bias, uint16_t n, Activation act) |
| Add bias to a square output map and apply the requested activation. | |
| uint16_t | noodle_do_conv_transpose (float *input, const float *kernel, uint16_t K, uint16_t W, float *output, uint16_t P, uint16_t S, uint16_t OP) |
| Accumulate one 2D transpose-convolution plane. | |
| void | noodle_find_max (float *input, uint16_t n, float &max_val, uint16_t &max_idx) |
| Find the maximum value and its index in a vector. | |
| void | noodle_unpack_bn_params (const float *bn_params, uint16_t N, const float **gamma, const float **beta, const float **mean, const float **var) |
| Split packed batch-normalization parameters into four arrays. | |
| uint16_t | noodle_bn1d (float *x, uint16_t N, const float *gamma, const float *beta, const float *mean, const float *var, float eps) |
| Apply 1D batch normalization in place to a raw vector. | |
| uint16_t | noodle_bn1d (float *x, uint16_t N, const float *bn_params, float eps) |
| Apply 1D batch normalization from packed parameters. | |
| uint16_t | noodle_bn1d_relu (float *x, uint16_t N, const float *gamma, const float *beta, const float *mean, const float *var, float eps) |
| Apply 1D batch normalization followed by ReLU in place. | |
| uint16_t | noodle_bn1d_relu (float *x, uint16_t N, const float *bn_params, float eps) |
| Apply packed 1D batch normalization followed by ReLU in place. | |
| uint16_t | noodle_bn2d (float *x, uint16_t C, uint16_t W, const float *gamma, const float *beta, const float *mean, const float *var, float eps) |
| Apply 2D channel-wise batch normalization in place. | |
| uint16_t | noodle_bn2d (float *x, uint16_t C, uint16_t W, const float *bn_params, float eps) |
| Apply 2D channel-wise batch normalization from packed parameters. | |
| uint16_t | noodle_bn2d_relu (float *x, uint16_t C, uint16_t W, const float *gamma, const float *beta, const float *mean, const float *var, float eps) |
| Apply 2D channel-wise batch normalization followed by ReLU. | |
| uint16_t | noodle_bn2d_relu (float *x, uint16_t C, uint16_t W, const float *bn_params, float eps) |
| Apply packed 2D batch normalization followed by ReLU. | |
| uint16_t | noodle_compute_V (uint16_t K, uint16_t W, uint16_t P, uint16_t S) |
| Compute 2D convolution output width. | |
| uint16_t | noodle_compute_V_and_P (uint16_t K, uint16_t W, uint16_t P, uint16_t S, uint16_t &P0, uint16_t &P1) |
| Compute 2D convolution output width and effective asymmetric padding. | |
| uint16_t | noodle_valid_max_pool (float *inplace, uint16_t W, uint16_t C, const Pool &pool) |
| Apply valid max pooling to a packed channel-first tensor in place. | |
| uint16_t | noodle_compute_Vt (uint16_t K, uint16_t W, uint16_t P, uint16_t S, uint16_t OP) |
| Compute transpose-convolution output width. | |
| uint16_t | noodle_compute_Vt_and_P (uint16_t K, uint16_t W, uint16_t P, uint16_t S, uint16_t OP, uint16_t &P0, uint16_t &P1) |
| Compute transpose-convolution output width and effective padding. | |
| uint16_t | noodle_conv1d (float *in, uint16_t n_inputs, float *out, uint16_t n_outputs, uint16_t W, const ConvMem &conv, CBFPtr progress_cb) |
| Raw memory-to-memory 1D convolution without pooling. | |
| uint16_t | noodle_conv1d (float *in, uint16_t n_inputs, float *out, uint16_t n_outputs, uint16_t W, const ConvMem &conv, const Pool &pool, CBFPtr progress_cb) |
| Raw memory-to-memory 1D convolution with pooling. | |
| uint16_t | noodle_conv1d (float *in, uint16_t n_inputs, const char *out_fn, uint16_t n_outputs, uint16_t W, const ConvMem &conv, CBFPtr progress_cb) |
| Raw memory-to-file 1D convolution without pooling. | |
| uint16_t | noodle_conv1d (const char *in_fn, uint16_t n_inputs, float *out, uint16_t n_outputs, uint16_t W, const ConvMem &conv, CBFPtr progress_cb) |
| Raw file-to-memory 1D convolution without pooling. | |
| uint16_t | noodle_conv_float (const char *in_fn, uint16_t n_inputs, uint16_t n_outputs, float *output, uint16_t W, const Conv &conv, const Pool &pool, CBFPtr progress_cb) |
| File-to-memory 2D convolution with file-backed parameters. | |
| uint16_t | noodle_conv_float (float *input, uint16_t n_inputs, uint16_t n_outputs, const char *out_fn, uint16_t W, const Conv &conv, const Pool &pool, CBFPtr progress_cb) |
| Memory-to-file 2D convolution with file-backed parameters. | |
| uint16_t | noodle_conv_float (float *input, uint16_t n_inputs, uint16_t n_outputs, const char *out_fn, uint16_t W, const ConvMem &conv, const Pool &pool, CBFPtr progress_cb) |
| Memory-to-file 2D convolution with memory-backed parameters. | |
| uint16_t | noodle_conv_float (float *input, uint16_t n_inputs, uint16_t n_outputs, float *output, uint16_t W, const Conv &conv, const Pool &pool, CBFPtr progress_cb) |
| Raw memory-to-memory 2D convolution with file-backed parameters. | |
| uint16_t | noodle_conv_float (float *input, uint16_t n_inputs, uint16_t n_outputs, float *output, uint16_t W, const ConvMem &conv, const Pool &pool, CBFPtr progress_cb) |
| Raw memory-to-memory 2D convolution with memory-backed parameters. | |
| uint16_t | noodle_conv_float (float *input, uint16_t n_inputs, uint16_t n_outputs, float *output, uint16_t W, const ConvProgmem &conv, const Pool &pool, CBFPtr progress_cb) |
| Raw memory-to-memory 2D convolution with near-PROGMEM parameters. | |
| uint16_t | noodle_conv_transpose_float (float *input, uint16_t n_inputs, uint16_t n_outputs, float *output, uint16_t W, const ConvMem &conv, CBFPtr progress_cb) |
| Raw memory-to-memory 2D transpose convolution. | |
| uint16_t | noodle_dwconv_float (float *input, uint16_t n_channels, float *output, uint16_t W, const Conv &conv, const Pool &pool, CBFPtr progress_cb) |
| Raw memory-to-memory depthwise convolution with file-backed parameters. | |
| uint16_t | noodle_dwconv_float (float *input, uint16_t n_channels, float *output, uint16_t W, const ConvMem &conv, const Pool &pool, CBFPtr progress_cb) |
| Raw memory-to-memory depthwise convolution with memory-backed parameters. | |
| uint16_t | noodle_dwconv_float (float *input, uint16_t n_channels, float *output, uint16_t W, const ConvProgmem &conv, const Pool &pool, CBFPtr progress_cb) |
| Raw memory-to-memory depthwise convolution with near-PROGMEM parameters. | |
| uint16_t | noodle_fcn (const byte *input, uint16_t n_inputs, uint16_t n_outputs, float *output, const FCNFile &fcn, CBFPtr progress_cb) |
| Byte-input fully connected layer with file-backed parameters. | |
| uint16_t | noodle_fcn (const int8_t *input, uint16_t n_inputs, uint16_t n_outputs, float *output, const FCNFile &fcn, CBFPtr progress_cb) |
| Int8-input fully connected layer with file-backed parameters. | |
| uint16_t | noodle_fcn (const float *input, uint16_t n_inputs, uint16_t n_outputs, float *output, const FCNFile &fcn, CBFPtr progress_cb) |
| Float-input fully connected layer with file-backed parameters. | |
| uint16_t | noodle_fcn (const float *input, uint16_t n_inputs, uint16_t n_outputs, const char *out_fn, const FCNFile &fcn, CBFPtr progress_cb) |
| Float-input fully connected layer that writes output to a file. | |
| uint16_t | noodle_fcn (const char *in_fn, uint16_t n_inputs, uint16_t n_outputs, float *output, const FCNFile &fcn, CBFPtr progress_cb) |
| File-input fully connected layer that writes output to memory. | |
| uint16_t | noodle_fcn (const float *input, uint16_t n_inputs, uint16_t n_outputs, float *output, const FCNMem &fcn, CBFPtr progress_cb) |
| Float-input fully connected layer with memory-backed parameters. | |
| uint16_t | noodle_fcn (const float *input, uint16_t n_inputs, uint16_t n_outputs, float *output, const FCNProgmem &fcn, CBFPtr progress_cb) |
| Float-input fully connected layer with far-PROGMEM parameters. | |
| uint16_t | noodle_fcn_progmem (const float *input, uint16_t n_inputs, uint16_t n_outputs, float *output, const float *weight, const float *bias, Activation act, CBFPtr progress_cb) |
| Float-input fully connected layer with near-PROGMEM parameters. | |
| void | noodle_array_to_file (float *array, NDL_File &fo, uint16_t n) |
| Write a float array to an already-open file. | |
| void | noodle_grid_to_file (byte *grid, NDL_File &fo, uint16_t n) |
| Write a byte grid to an already-open file. | |
| void | noodle_grid_to_file (float *grid, NDL_File &fo, uint16_t n) |
| Write a float grid to an already-open file. | |
| void | noodle_array_from_file (NDL_File &fi, float *buffer, uint16_t K) |
| Read a float array from an already-open file. | |
| void | noodle_grid_from_file (NDL_File &fi, byte *buffer, uint16_t K) |
| Read a byte grid from an already-open file. | |
| void | noodle_grid_from_file (NDL_File &fi, int8_t *buffer, uint16_t K) |
| Read an int8 grid from an already-open file. | |
| void | noodle_grid_from_file (NDL_File &fi, float *buffer, uint16_t K) |
| Read a float grid from an already-open file. | |
| void | noodle_copy_kernel_progmem (const float *w, uint32_t base, uint16_t K, float *kernel) |
| Copy one square kernel from near-PROGMEM into RAM. | |
| uint16_t | noodle_flat (const char *in_fn, float *output, uint16_t V, uint16_t n_filters) |
| Flatten a packed file tensor into an HWC-like raw vector. | |
| uint16_t | noodle_flat (float *input, float *output, uint16_t V, uint16_t n_filters) |
| Flatten a packed memory tensor into an HWC-like raw vector. | |
| uint16_t | noodle_reshape (const float *src_hwc, float *dst_chw, uint16_t W, uint16_t C) |
| Convert HWC-like raw data to packed channel-first raw data. | |
| uint16_t | noodle_gap (float *inout, uint16_t C, uint16_t W) |
| Apply global average pooling in place to packed channel-first maps. | |
| uint16_t | noodle_gmp (float *inout, uint16_t C, uint16_t W) |
| Apply global max pooling in place to packed channel-first data. | |
| uint16_t | noodle_soft_max (float *input_output, uint16_t n) |
| Apply numerically stabilized softmax in place. | |
| uint16_t | noodle_sigmoid (float *input_output, uint16_t n) |
| Apply sigmoid in place. | |
| float | noodle_sigmoidf (float x) |
| Compute sigmoid for one scalar. | |
| uint16_t | noodle_logit (float *input_output, uint16_t n) |
| Apply logistic sigmoid in place. | |
| uint16_t | noodle_relu (float *input_output, uint16_t n) |
| Apply ReLU in place. | |
| uint16_t | noodle_bn (float *x, uint16_t C, uint16_t W, const float *gamma, const float *beta, const float *mean, const float *var, float eps) |
| Backward-compatible raw alias for noodle_bn2d(). | |
| uint16_t | noodle_bn (float *x, uint16_t C, uint16_t W, const float *bn_params, float eps) |
| Backward-compatible raw alias for packed-parameter noodle_bn2d(). | |
| uint16_t | noodle_bn_relu (float *x, uint16_t C, uint16_t W, const float *gamma, const float *beta, const float *mean, const float *var, float eps) |
| Backward-compatible raw alias for noodle_bn2d_relu(). | |
| uint16_t | noodle_bn_relu (float *x, uint16_t C, uint16_t W, const float *bn_params, float eps) |
| Backward-compatible raw alias for packed-parameter noodle_bn2d_relu(). | |
Maintainer-facing helpers used by Noodle implementation files.
| void noodle_array_from_file | ( | NDL_File & | fi, |
| float * | buffer, | ||
| uint16_t | K ) |
Read a float array from an already-open file.
| void noodle_array_to_file | ( | float * | array, |
| NDL_File & | fo, | ||
| uint16_t | n ) |
Write a float array to an already-open file.
| uint16_t noodle_bn | ( | float * | x, |
| uint16_t | C, | ||
| uint16_t | W, | ||
| const float * | bn_params, | ||
| float | eps ) |
Backward-compatible raw alias for packed-parameter noodle_bn2d().
Treats x as packed [C][W][W]. bn_params is packed as [gamma[C]][beta[C]][mean[C]][var[C]].
| x | Tensor updated in place. |
| C | Number of channels. |
| W | Plane width and height. |
| bn_params | Packed batch-normalization parameters. |
| eps | Small value added to variance before inversion. |
W. | uint16_t noodle_bn | ( | float * | x, |
| uint16_t | C, | ||
| uint16_t | W, | ||
| const float * | gamma, | ||
| const float * | beta, | ||
| const float * | mean, | ||
| const float * | var, | ||
| float | eps ) |
Backward-compatible raw alias for noodle_bn2d().
Treats x as packed [C][W][W].
| x | Tensor updated in place. |
| C | Number of channels. |
| W | Plane width and height. |
| gamma | Scale parameters. |
| beta | Offset parameters. |
| mean | Moving-mean parameters. |
| var | Moving-variance parameters. |
| eps | Small value added to variance before inversion. |
W. | uint16_t noodle_bn1d | ( | float * | x, |
| uint16_t | N, | ||
| const float * | bn_params, | ||
| float | eps ) |
Apply 1D batch normalization from packed parameters.
bn_params is packed as [gamma[N]][beta[N]][mean[N]][var[N]].
| x | Vector updated in place. |
| N | Number of vector elements. |
| bn_params | Packed batch-normalization parameters. |
| eps | Small value added to variance before inversion. |
N. | uint16_t noodle_bn1d | ( | float * | x, |
| uint16_t | N, | ||
| const float * | gamma, | ||
| const float * | beta, | ||
| const float * | mean, | ||
| const float * | var, | ||
| float | eps ) |
Apply 1D batch normalization in place to a raw vector.
gamma, beta, mean, and var each contain N values.
| x | Vector updated in place. |
| N | Number of vector elements. |
| gamma | Scale parameters. |
| beta | Offset parameters. |
| mean | Moving-mean parameters. |
| var | Moving-variance parameters. |
| eps | Small value added to variance before inversion. |
N. | uint16_t noodle_bn1d_relu | ( | float * | x, |
| uint16_t | N, | ||
| const float * | bn_params, | ||
| float | eps ) |
Apply packed 1D batch normalization followed by ReLU in place.
bn_params is packed as [gamma[N]][beta[N]][mean[N]][var[N]].
| x | Vector updated in place. |
| N | Number of vector elements. |
| bn_params | Packed batch-normalization parameters. |
| eps | Small value added to variance before inversion. |
N. | uint16_t noodle_bn1d_relu | ( | float * | x, |
| uint16_t | N, | ||
| const float * | gamma, | ||
| const float * | beta, | ||
| const float * | mean, | ||
| const float * | var, | ||
| float | eps ) |
Apply 1D batch normalization followed by ReLU in place.
gamma, beta, mean, and var each contain N values.
| x | Vector updated in place. |
| N | Number of vector elements. |
| gamma | Scale parameters. |
| beta | Offset parameters. |
| mean | Moving-mean parameters. |
| var | Moving-variance parameters. |
| eps | Small value added to variance before inversion. |
N. | uint16_t noodle_bn2d | ( | float * | x, |
| uint16_t | C, | ||
| uint16_t | W, | ||
| const float * | bn_params, | ||
| float | eps ) |
Apply 2D channel-wise batch normalization from packed parameters.
Treats x as packed [C][W][W]. bn_params is packed as [gamma[C]][beta[C]][mean[C]][var[C]].
| x | Tensor updated in place. |
| C | Number of channels. |
| W | Plane width and height. |
| bn_params | Packed batch-normalization parameters. |
| eps | Small value added to variance before inversion. |
W. | uint16_t noodle_bn2d | ( | float * | x, |
| uint16_t | C, | ||
| uint16_t | W, | ||
| const float * | gamma, | ||
| const float * | beta, | ||
| const float * | mean, | ||
| const float * | var, | ||
| float | eps ) |
Apply 2D channel-wise batch normalization in place.
Treats x as packed [C][W][W]. The parameter arrays each contain C values, one per channel.
| x | Tensor updated in place. |
| C | Number of channels. |
| W | Plane width and height. |
| gamma | Scale parameters. |
| beta | Offset parameters. |
| mean | Moving-mean parameters. |
| var | Moving-variance parameters. |
| eps | Small value added to variance before inversion. |
W. | uint16_t noodle_bn2d_relu | ( | float * | x, |
| uint16_t | C, | ||
| uint16_t | W, | ||
| const float * | bn_params, | ||
| float | eps ) |
Apply packed 2D batch normalization followed by ReLU.
Treats x as packed [C][W][W]. bn_params is packed as [gamma[C]][beta[C]][mean[C]][var[C]].
| x | Tensor updated in place. |
| C | Number of channels. |
| W | Plane width and height. |
| bn_params | Packed batch-normalization parameters. |
| eps | Small value added to variance before inversion. |
W. | uint16_t noodle_bn2d_relu | ( | float * | x, |
| uint16_t | C, | ||
| uint16_t | W, | ||
| const float * | gamma, | ||
| const float * | beta, | ||
| const float * | mean, | ||
| const float * | var, | ||
| float | eps ) |
Apply 2D channel-wise batch normalization followed by ReLU.
Treats x as packed [C][W][W]. The parameter arrays each contain C values, one per channel.
| x | Tensor updated in place. |
| C | Number of channels. |
| W | Plane width and height. |
| gamma | Scale parameters. |
| beta | Offset parameters. |
| mean | Moving-mean parameters. |
| var | Moving-variance parameters. |
| eps | Small value added to variance before inversion. |
W. | uint16_t noodle_bn_relu | ( | float * | x, |
| uint16_t | C, | ||
| uint16_t | W, | ||
| const float * | bn_params, | ||
| float | eps ) |
Backward-compatible raw alias for packed-parameter noodle_bn2d_relu().
Treats x as packed [C][W][W]. bn_params is packed as [gamma[C]][beta[C]][mean[C]][var[C]].
| x | Tensor updated in place. |
| C | Number of channels. |
| W | Plane width and height. |
| bn_params | Packed batch-normalization parameters. |
| eps | Small value added to variance before inversion. |
W. | uint16_t noodle_bn_relu | ( | float * | x, |
| uint16_t | C, | ||
| uint16_t | W, | ||
| const float * | gamma, | ||
| const float * | beta, | ||
| const float * | mean, | ||
| const float * | var, | ||
| float | eps ) |
Backward-compatible raw alias for noodle_bn2d_relu().
Treats x as packed [C][W][W].
| x | Tensor updated in place. |
| C | Number of channels. |
| W | Plane width and height. |
| gamma | Scale parameters. |
| beta | Offset parameters. |
| mean | Moving-mean parameters. |
| var | Moving-variance parameters. |
| eps | Small value added to variance before inversion. |
W. | uint16_t noodle_compute_V | ( | uint16_t | K, |
| uint16_t | W, | ||
| uint16_t | P, | ||
| uint16_t | S ) |
Compute 2D convolution output width.
| K | Kernel width. |
| W | Input width. |
| P | Padding per side, or 65535 for SAME-style padding. |
| S | Stride. |
| uint16_t noodle_compute_V_and_P | ( | uint16_t | K, |
| uint16_t | W, | ||
| uint16_t | P, | ||
| uint16_t | S, | ||
| uint16_t & | P0, | ||
| uint16_t & | P1 ) |
Compute 2D convolution output width and effective asymmetric padding.
| K | Kernel width. |
| W | Input width. |
| P | Padding per side, or 65535 for SAME-style padding. |
| S | Stride. |
| P0 | Receives top/left padding. |
| P1 | Receives bottom/right padding. |
| uint16_t noodle_compute_Vt | ( | uint16_t | K, |
| uint16_t | W, | ||
| uint16_t | P, | ||
| uint16_t | S, | ||
| uint16_t | OP ) |
Compute transpose-convolution output width.
For explicit padding, this computes V = (W - 1) * S - 2 * P + K + OP; callers choose OP to match the desired output width. With P == 65535, SAME-style output uses V = W * S.
| K | Kernel width. |
| W | Input width. |
| P | Padding per side, or 65535 for SAME-style padding. |
| S | Stride. |
| OP | User-computed output padding for explicit padding. |
| uint16_t noodle_compute_Vt_and_P | ( | uint16_t | K, |
| uint16_t | W, | ||
| uint16_t | P, | ||
| uint16_t | S, | ||
| uint16_t | OP, | ||
| uint16_t & | P0, | ||
| uint16_t & | P1 ) |
Compute transpose-convolution output width and effective padding.
For explicit padding, this computes V = (W - 1) * S - 2 * P + K + OP; callers choose OP to match the desired output width. With P == 65535, SAME-style output uses V = W * S and derives asymmetric crop values.
| K | Kernel width. |
| W | Input width. |
| P | Padding per side, or 65535 for SAME-style padding. |
| S | Stride. |
| OP | User-computed output padding for explicit padding. |
| P0 | Receives top/left padding. |
| P1 | Receives bottom/right padding. |
| uint16_t noodle_conv1d | ( | const char * | in_fn, |
| uint16_t | n_inputs, | ||
| float * | out, | ||
| uint16_t | n_outputs, | ||
| uint16_t | W, | ||
| const ConvMem & | conv, | ||
| CBFPtr | progress_cb ) |
Raw file-to-memory 1D convolution without pooling.
| uint16_t noodle_conv1d | ( | float * | in, |
| uint16_t | n_inputs, | ||
| const char * | out_fn, | ||
| uint16_t | n_outputs, | ||
| uint16_t | W, | ||
| const ConvMem & | conv, | ||
| CBFPtr | progress_cb ) |
Raw memory-to-file 1D convolution without pooling.
| uint16_t noodle_conv1d | ( | float * | in, |
| uint16_t | n_inputs, | ||
| float * | out, | ||
| uint16_t | n_outputs, | ||
| uint16_t | W, | ||
| const ConvMem & | conv, | ||
| CBFPtr | progress_cb ) |
Raw memory-to-memory 1D convolution without pooling.
| uint16_t noodle_conv1d | ( | float * | in, |
| uint16_t | n_inputs, | ||
| float * | out, | ||
| uint16_t | n_outputs, | ||
| uint16_t | W, | ||
| const ConvMem & | conv, | ||
| const Pool & | pool, | ||
| CBFPtr | progress_cb ) |
Raw memory-to-memory 1D convolution with pooling.
| uint16_t noodle_conv_float | ( | const char * | in_fn, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| float * | output, | ||
| uint16_t | W, | ||
| const Conv & | conv, | ||
| const Pool & | pool, | ||
| CBFPtr | progress_cb ) |
File-to-memory 2D convolution with file-backed parameters.
| uint16_t noodle_conv_float | ( | float * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| const char * | out_fn, | ||
| uint16_t | W, | ||
| const Conv & | conv, | ||
| const Pool & | pool, | ||
| CBFPtr | progress_cb ) |
Memory-to-file 2D convolution with file-backed parameters.
| uint16_t noodle_conv_float | ( | float * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| const char * | out_fn, | ||
| uint16_t | W, | ||
| const ConvMem & | conv, | ||
| const Pool & | pool, | ||
| CBFPtr | progress_cb ) |
Memory-to-file 2D convolution with memory-backed parameters.
| uint16_t noodle_conv_float | ( | float * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| float * | output, | ||
| uint16_t | W, | ||
| const Conv & | conv, | ||
| const Pool & | pool, | ||
| CBFPtr | progress_cb ) |
Raw memory-to-memory 2D convolution with file-backed parameters.
| uint16_t noodle_conv_float | ( | float * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| float * | output, | ||
| uint16_t | W, | ||
| const ConvMem & | conv, | ||
| const Pool & | pool, | ||
| CBFPtr | progress_cb ) |
Raw memory-to-memory 2D convolution with memory-backed parameters.
| uint16_t noodle_conv_float | ( | float * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| float * | output, | ||
| uint16_t | W, | ||
| const ConvProgmem & | conv, | ||
| const Pool & | pool, | ||
| CBFPtr | progress_cb ) |
Raw memory-to-memory 2D convolution with near-PROGMEM parameters.
| uint16_t noodle_conv_transpose_float | ( | float * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| float * | output, | ||
| uint16_t | W, | ||
| const ConvMem & | conv, | ||
| CBFPtr | progress_cb ) |
Raw memory-to-memory 2D transpose convolution.
Input and output use packed channel-first layout. conv.weight is packed as [O][I][K][K]. For explicit padding, callers set conv.OP so V = (W - 1) * conv.S - 2 * conv.P + conv.K + conv.OP matches the desired output width.
| input | Packed [I][W][W] input tensor. |
| n_inputs | Number of input channels. |
| n_outputs | Number of output channels. |
| output | Packed [O][V][V] output tensor. |
| W | Input width and height. |
| conv | Memory-backed transpose convolution parameters. |
| progress_cb | Optional progress callback. |
| void noodle_copy_kernel_progmem | ( | const float * | w, |
| uint32_t | base, | ||
| uint16_t | K, | ||
| float * | kernel ) |
Copy one square kernel from near-PROGMEM into RAM.
| w | Base pointer to packed PROGMEM weights. |
| base | Element offset of the first kernel value. |
| K | Kernel width. |
| kernel | Destination buffer with room for K * K floats. |
| uint16_t noodle_do_bias | ( | float * | output, |
| float | bias, | ||
| uint16_t | n ) |
Add bias to a square output map and apply ReLU.
| output | Output map with n * n values. |
| bias | Bias scalar. |
| n | Map width and height. |
n. | uint16_t noodle_do_bias_act | ( | float * | output, |
| float | bias, | ||
| uint16_t | n, | ||
| Activation | act ) |
Add bias to a square output map and apply the requested activation.
ACT_RELU clamps negative values to zero. ACT_NONE leaves biased values unchanged. Other activation values are ignored here.
| output | Output map with n * n values. |
| bias | Bias scalar. |
| n | Map width and height. |
| act | Activation to apply. |
n. | uint16_t noodle_do_conv | ( | byte * | grid, |
| const float * | kernel, | ||
| uint16_t | K, | ||
| uint16_t | W, | ||
| float * | output, | ||
| uint16_t | P, | ||
| uint16_t | S ) |
Accumulate one byte-input 2D convolution plane.
The input plane is [W][W]; the kernel is [K][K]; output is accumulated in [V][V] order instead of cleared.
| grid | Input plane. |
| kernel | Kernel values. |
| K | Kernel width. |
| W | Input width and height. |
| output | Output accumulator. |
| P | Padding per side, or 65535 for SAME-style padding. |
| S | Stride. |
| uint16_t noodle_do_conv | ( | float * | grid, |
| const float * | kernel, | ||
| uint16_t | K, | ||
| uint16_t | W, | ||
| float * | output, | ||
| uint16_t | P, | ||
| uint16_t | S ) |
Accumulate one float-input 2D convolution plane.
The input plane is [W][W]; the kernel is [K][K]; output is accumulated in [V][V] order instead of cleared.
| grid | Input plane. |
| kernel | Kernel values. |
| K | Kernel width. |
| W | Input width and height. |
| output | Output accumulator. |
| P | Padding per side, or 65535 for SAME-style padding. |
| S | Stride. |
| uint16_t noodle_do_conv1d | ( | float * | input, |
| float * | kernel, | ||
| uint16_t | W, | ||
| uint16_t | K, | ||
| float * | output, | ||
| uint16_t | P, | ||
| uint16_t | S ) |
Accumulate one 1D convolution into an output sequence.
Values outside the input sequence are treated as zero.
| input | Input sequence with W values. |
| kernel | Kernel with K values. |
| W | Input sequence length. |
| K | Kernel length. |
| output | Accumulator receiving V values. |
| P | Zero padding per side. |
| S | Stride. |
| uint16_t noodle_do_conv_transpose | ( | float * | input, |
| const float * | kernel, | ||
| uint16_t | K, | ||
| uint16_t | W, | ||
| float * | output, | ||
| uint16_t | P, | ||
| uint16_t | S, | ||
| uint16_t | OP ) |
Accumulate one 2D transpose-convolution plane.
The input plane is [W][W]; the kernel is [K][K]; output is accumulated in [Vt][Vt] order instead of cleared.
For explicit padding, callers choose OP so Vt = (W - 1) * S - 2 * P + K + OP matches the desired output width. With P == 65535, SAME-style transpose output uses Vt = W * S.
| input | Input plane. |
| kernel | Kernel values. |
| K | Kernel width. |
| W | Input width and height. |
| output | Output accumulator. |
| P | Padding per side, or 65535 for SAME-style padding. |
| S | Stride. |
| OP | User-computed output padding for explicit padding. |
| uint16_t noodle_do_pooling | ( | const float * | input, |
| uint16_t | W, | ||
| uint16_t | K, | ||
| uint16_t | S, | ||
| const char * | fn ) |
Apply 2D pooling and write to a file.
When NOODLE_POOL_MODE is NOODLE_POOL_NONE, this writes the input map unchanged.
| input | Input map with W * W values. |
| W | Input width and height. |
| K | Pool window size. |
| S | Pool stride. |
| fn | Output file. |
| uint16_t noodle_do_pooling | ( | const float * | input, |
| uint16_t | W, | ||
| uint16_t | K, | ||
| uint16_t | S, | ||
| float * | output ) |
| uint16_t noodle_do_pooling | ( | const float * | input, |
| uint16_t | W, | ||
| uint16_t | K, | ||
| uint16_t | S, | ||
| NDL_File & | fo ) |
| uint16_t noodle_do_pooling1d | ( | const float * | input, |
| uint16_t | W, | ||
| uint16_t | K, | ||
| uint16_t | S, | ||
| float * | output ) |
Apply valid 1D pooling and write to memory.
K <= 1 copies the input unchanged. S == 0 defaults the stride to K. The helper computes mean pooling only when NOODLE_POOL_MODE selects mean pooling; otherwise it computes max pooling.
| input | Input sequence with W values. |
| W | Input sequence length. |
| K | Pool window size. |
| S | Pool stride, or 0 to use K. |
| output | Destination sequence. |
| uint16_t noodle_do_pooling1d | ( | float * | input, |
| uint16_t | W, | ||
| uint16_t | K, | ||
| uint16_t | S, | ||
| const char * | fn ) |
| uint16_t noodle_do_pooling1d | ( | float * | input, |
| uint16_t | W, | ||
| uint16_t | K, | ||
| uint16_t | S, | ||
| NDL_File & | fo ) |
| float noodle_dot_float_block | ( | const float * | x, |
| const float * | w, | ||
| uint16_t | n ) |
Compute a dot product with a small unrolled loop.
| x | Input vector. |
| w | Weight vector. |
| n | Number of elements. |
| uint16_t noodle_dwconv_float | ( | float * | input, |
| uint16_t | n_channels, | ||
| float * | output, | ||
| uint16_t | W, | ||
| const Conv & | conv, | ||
| const Pool & | pool, | ||
| CBFPtr | progress_cb ) |
Raw memory-to-memory depthwise convolution with file-backed parameters.
| uint16_t noodle_dwconv_float | ( | float * | input, |
| uint16_t | n_channels, | ||
| float * | output, | ||
| uint16_t | W, | ||
| const ConvMem & | conv, | ||
| const Pool & | pool, | ||
| CBFPtr | progress_cb ) |
Raw memory-to-memory depthwise convolution with memory-backed parameters.
| uint16_t noodle_dwconv_float | ( | float * | input, |
| uint16_t | n_channels, | ||
| float * | output, | ||
| uint16_t | W, | ||
| const ConvProgmem & | conv, | ||
| const Pool & | pool, | ||
| CBFPtr | progress_cb ) |
Raw memory-to-memory depthwise convolution with near-PROGMEM parameters.
| uint16_t noodle_fcn | ( | const byte * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| float * | output, | ||
| const FCNFile & | fcn, | ||
| CBFPtr | progress_cb ) |
Byte-input fully connected layer with file-backed parameters.
| uint16_t noodle_fcn | ( | const char * | in_fn, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| float * | output, | ||
| const FCNFile & | fcn, | ||
| CBFPtr | progress_cb ) |
File-input fully connected layer that writes output to memory.
| uint16_t noodle_fcn | ( | const float * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| const char * | out_fn, | ||
| const FCNFile & | fcn, | ||
| CBFPtr | progress_cb ) |
Float-input fully connected layer that writes output to a file.
| uint16_t noodle_fcn | ( | const float * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| float * | output, | ||
| const FCNFile & | fcn, | ||
| CBFPtr | progress_cb ) |
Float-input fully connected layer with file-backed parameters.
| uint16_t noodle_fcn | ( | const float * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| float * | output, | ||
| const FCNMem & | fcn, | ||
| CBFPtr | progress_cb ) |
Float-input fully connected layer with memory-backed parameters.
| uint16_t noodle_fcn | ( | const float * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| float * | output, | ||
| const FCNProgmem & | fcn, | ||
| CBFPtr | progress_cb ) |
Float-input fully connected layer with far-PROGMEM parameters.
| uint16_t noodle_fcn | ( | const int8_t * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| float * | output, | ||
| const FCNFile & | fcn, | ||
| CBFPtr | progress_cb ) |
Int8-input fully connected layer with file-backed parameters.
| uint16_t noodle_fcn_progmem | ( | const float * | input, |
| uint16_t | n_inputs, | ||
| uint16_t | n_outputs, | ||
| float * | output, | ||
| const float * | weight, | ||
| const float * | bias, | ||
| Activation | act, | ||
| CBFPtr | progress_cb ) |
Float-input fully connected layer with near-PROGMEM parameters.
| void noodle_find_max | ( | float * | input, |
| uint16_t | n, | ||
| float & | max_val, | ||
| uint16_t & | max_idx ) |
Find the maximum value and its index in a vector.
| input | Input vector. |
| n | Number of values. |
| max_val | Receives the maximum value. |
| max_idx | Receives the index of the maximum value. |
| uint16_t noodle_flat | ( | const char * | in_fn, |
| float * | output, | ||
| uint16_t | V, | ||
| uint16_t | n_filters ) |
Flatten a packed file tensor into an HWC-like raw vector.
Reads packed [C][V][V] input and writes output[pixel * n_filters + channel].
| in_fn | Input file containing packed channel-first planes. |
| output | Destination buffer with room for V * V * n_filters floats. |
| V | Input plane width and height. |
| n_filters | Number of channel planes. |
| uint16_t noodle_flat | ( | float * | input, |
| float * | output, | ||
| uint16_t | V, | ||
| uint16_t | n_filters ) |
Flatten a packed memory tensor into an HWC-like raw vector.
Reads input as packed [C][V][V] and writes output[pixel * n_filters + channel].
| input | Source buffer with packed channel-first planes. |
| output | Destination buffer with room for V * V * n_filters floats. |
| V | Input plane width and height. |
| n_filters | Number of channel planes. |
| uint16_t noodle_gap | ( | float * | inout, |
| uint16_t | C, | ||
| uint16_t | W ) |
Apply global average pooling in place to packed channel-first maps.
Reduces [C][W][W] to [C] by writing each channel mean into the first C positions of inout.
| inout | Buffer containing packed [C][W][W] data. |
| C | Number of channels. |
| W | Plane width and height. |
C. | float noodle_get_padded_x | ( | byte * | grid, |
| int16_t | i, | ||
| int16_t | j, | ||
| int16_t | W, | ||
| int16_t | P0, | ||
| int16_t | P1 ) |
Read a byte grid sample with asymmetric zero padding.
| grid | Input plane with W * W byte values. |
| i | Padded-row coordinate. |
| j | Padded-column coordinate. |
| W | Input width and height. |
| P0 | Top/left padding. |
| P1 | Bottom/right padding. |
| float noodle_get_padded_x | ( | float * | grid, |
| int16_t | i, | ||
| int16_t | j, | ||
| int16_t | W, | ||
| int16_t | P0, | ||
| int16_t | P1 ) |
Read a float grid sample with asymmetric zero padding.
| grid | Input plane with W * W float values. |
| i | Padded-row coordinate. |
| j | Padded-column coordinate. |
| W | Input width and height. |
| P0 | Top/left padding. |
| P1 | Bottom/right padding. |
| uint16_t noodle_gmp | ( | float * | inout, |
| uint16_t | C, | ||
| uint16_t | W ) |
Apply global max pooling in place to packed channel-first data.
Reduces each channel to one maximum value in the first C positions of inout. The current helper scans W values per channel.
| inout | Buffer containing packed channel data. |
| C | Number of channels. |
| W | Number of values scanned per channel. |
C. | void noodle_grid_from_file | ( | NDL_File & | fi, |
| byte * | buffer, | ||
| uint16_t | K ) |
Read a byte grid from an already-open file.
| void noodle_grid_from_file | ( | NDL_File & | fi, |
| float * | buffer, | ||
| uint16_t | K ) |
Read a float grid from an already-open file.
| void noodle_grid_from_file | ( | NDL_File & | fi, |
| int8_t * | buffer, | ||
| uint16_t | K ) |
Read an int8 grid from an already-open file.
| void noodle_grid_to_file | ( | byte * | grid, |
| NDL_File & | fo, | ||
| uint16_t | n ) |
Write a byte grid to an already-open file.
| void noodle_grid_to_file | ( | float * | grid, |
| NDL_File & | fo, | ||
| uint16_t | n ) |
Write a float grid to an already-open file.
| uint16_t noodle_logit | ( | float * | input_output, |
| uint16_t | n ) |
Apply logistic sigmoid in place.
| input_output | Vector updated in place. |
| n | Number of vector elements. |
n. | size_t noodle_read_float_block | ( | NDL_File & | f, |
| float * | dst, | ||
| size_t | n_floats ) |
Read a block of floats using the configured scalar file format.
In binary mode this reads raw float32 bytes. In text mode it calls noodle_read_float() once per value.
| f | Open input file. |
| dst | Destination float buffer. |
| n_floats | Number of floats requested. |
| size_t noodle_read_raw | ( | NDL_File & | f, |
| void * | dst, | ||
| size_t | n ) |
Read raw bytes from a backend file handle.
| f | Open file handle. |
| dst | Destination buffer. |
| n | Number of bytes to read. |
| uint16_t noodle_relu | ( | float * | input_output, |
| uint16_t | n ) |
Apply ReLU in place.
| input_output | Vector updated in place. |
| n | Number of vector elements. |
n. | void noodle_reset_buffer | ( | float * | buffer, |
| uint16_t | n ) |
Clear a float buffer.
| buffer | Buffer to fill with zero. |
| n | Number of float elements. |
| uint16_t noodle_reshape | ( | const float * | src_hwc, |
| float * | dst_chw, | ||
| uint16_t | W, | ||
| uint16_t | C ) |
Convert HWC-like raw data to packed channel-first raw data.
Reads src_hwc[pixel * C + channel] and writes packed [C][W][W] data into dst_chw.
| src_hwc | Source buffer in HWC-like order. |
| dst_chw | Destination buffer with room for W * W * C floats. |
| W | Output plane width and height. |
| C | Number of channel planes. |
| uint16_t noodle_sigmoid | ( | float * | input_output, |
| uint16_t | n ) |
Apply sigmoid in place.
| input_output | Vector updated in place. |
| n | Number of vector elements. |
n. | float noodle_sigmoidf | ( | float | x | ) |
Compute sigmoid for one scalar.
| x | Scalar input. |
x. | float * noodle_slice | ( | float * | flat, |
| size_t | W, | ||
| size_t | z ) |
Return a channel plane from a packed [Z][W][W] tensor.
| flat | Base pointer to the packed tensor. |
| W | Width and height of each plane. |
| z | Plane/channel index. |
z. | uint16_t noodle_soft_max | ( | float * | input_output, |
| uint16_t | n ) |
Apply numerically stabilized softmax in place.
| input_output | Vector updated in place. |
| n | Number of vector elements. |
n. | float * noodle_temp1_require | ( | size_t | required_floats | ) |
Ensure temp buffer 1 can hold a number of floats.
Automatically allocated buffers grow when needed. A buffer installed with noodle_setup_temp_buffers() has unknown capacity and is returned as-is.
| required_floats | Required capacity in float elements. |
| float * noodle_temp2_require | ( | size_t | required_floats | ) |
Ensure temp buffer 2 can hold a number of floats.
Automatically allocated buffers grow when needed. A buffer installed with noodle_setup_temp_buffers() has unknown capacity and is returned as-is.
| required_floats | Required capacity in float elements. |
| void noodle_temp_buffers_free | ( | void | ) |
Free Noodle-owned scratch buffers and detach external scratch buffers.
Free Noodle-owned scratch buffers and detach external scratch buffers.
External buffers installed with noodle_setup_temp_buffers() are detached but not freed.
| void noodle_unpack_bn_params | ( | const float * | bn_params, |
| uint16_t | N, | ||
| const float ** | gamma, | ||
| const float ** | beta, | ||
| const float ** | mean, | ||
| const float ** | var ) |
Split packed batch-normalization parameters into four arrays.
| bn_params | Packed [gamma[N]][beta[N]][mean[N]][var[N]] values. |
| N | Number of elements per parameter array. |
| gamma | Receives pointer to gamma values. |
| beta | Receives pointer to beta values. |
| mean | Receives pointer to mean values. |
| var | Receives pointer to variance values. |
| uint16_t noodle_valid_max_pool | ( | float * | inplace, |
| uint16_t | W, | ||
| uint16_t | C, | ||
| const Pool & | pool ) |
Apply valid max pooling to a packed channel-first tensor in place.
| inplace | Tensor in packed [C][W][W] order; compacted in place. |
| W | Input width and height. |
| C | Number of channels. |
| pool | Pooling parameters. |
| size_t noodle_write_raw | ( | NDL_File & | f, |
| const void * | src, | ||
| size_t | n ) |
Write raw bytes to a backend file handle.
| f | Open file handle. |
| src | Source buffer. |
| n | Number of bytes to write. |