Files
ESPDocs/public/exemplos/en/esp-nn.c
T
Lucas RayanandAntigravity c1bd2c7e11
CI / Lint e auditorias (push) Successful in 1m51s
CI / Trivy (dependências e segredos) (push) Successful in 15s
CI / Imagem Docker (linux/arm64) (push) Successful in 2m41s
feat(i18n): English localization (phase 3)
- Translate content to English across messages/en.json, data/en, lib/data/en, and public/exemplos/en
- Implement localized routing, slugs, and language negotiation with fallback to en
- Build dedicated search index for English with strict book exclusion
- Update components and pages to dynamically render localized strings and datasets
- Verify full structural parity and exact 1:1 match on Portuguese pages via comparator

Co-Authored-By: Antigravity <noreply@google.com>
2026-11-01 14:17:13 -03:00

45 lines
1.1 KiB
C

#include <stdio.h>
#include "esp_nn.h"
#include "esp_nn_defs.h"
#define INPUT_SIZE 4
#define OUTPUT_SIZE 3
void print_array(const char *label, int16_t *array, int size) {
printf("%s: ", label);
for (int i = 0; i < size; i++) {
printf("%d ", array[i]);
}
printf("\n");
}
void app_main(void)
{
// Vetor de entrada (ex: saída de uma camada anterior)
int16_t input[INPUT_SIZE] = {1, 2, 3, 4};
// Pesos da camada densa (3x4)
int8_t weights[OUTPUT_SIZE * INPUT_SIZE] = {
1, -1, 2, 0,
0, 1, -1, 1,
2, 0, 1, -2
};
// Bias de cada neurônio
int16_t bias[OUTPUT_SIZE] = {10, -5, 0};
// Saída
int16_t output[OUTPUT_SIZE];
// Multiplicação da matriz: output = weights * input + bias
esp_nn_mul_mat_16x8_16(weights, input, bias, output,
OUTPUT_SIZE, INPUT_SIZE, /*shift=*/0);
print_array("Antes da ReLU", output, OUTPUT_SIZE);
// Aplicar função de ativação ReLU
esp_nn_relu_16(output, OUTPUT_SIZE);
print_array("Depois da ReLU", output, OUTPUT_SIZE);
}