-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
408 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#ifndef __NN_H | ||
#define __NN_H | ||
|
||
#include <assert.h> | ||
|
||
#include "nn_tensor.h" | ||
#include "nn_print.h" | ||
#include "nn_add.h" | ||
#include "nn_copy.h" | ||
#include "nn_matmul.h" | ||
|
||
|
||
// http://elm-chan.org/junk/32bit/binclude.html | ||
#define INCLUDE_FILE(section, filename, symbol) asm (\ | ||
".section "#section"\n" /* Change section */\ | ||
".balign 4\n" /* Word alignment */\ | ||
".global "#symbol"_start\n" /* Export the object start address */\ | ||
".global "#symbol"_data\n" /* Export the object address */\ | ||
#symbol"_start:\n" /* Define the object start address label */\ | ||
#symbol"_data:\n" /* Define the object label */\ | ||
".incbin \""filename"\"\n" /* Import the file */\ | ||
".global "#symbol"_end\n" /* Export the object end address */\ | ||
#symbol"_end:\n" /* Define the object end address label */\ | ||
".balign 4\n" /* Word alignment */\ | ||
".section \".text\"\n") /* Restore section */ | ||
|
||
|
||
|
||
void NN_assert(int condition, char *message) { | ||
if (!condition) { | ||
printf("Assertion failed: "); | ||
printf("%s\n", message); | ||
exit(1); | ||
} | ||
} | ||
|
||
|
||
|
||
#endif // __NN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef __NN_COPY_H | ||
#define __NN_COPY_H | ||
|
||
#include "nn_tensor.h" | ||
|
||
|
||
/** | ||
* Copies values from one tensor to another | ||
* | ||
* @param dst: destination tensor | ||
* @param src: source tensor | ||
*/ | ||
void NN_copy(Tensor *dst, Tensor *src); | ||
|
||
|
||
#endif // __NN_COPY_H |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef __NN_PRINT_H | ||
#define __NN_PRINT_H | ||
|
||
#include "nn_tensor.h" | ||
|
||
|
||
void NN_printFloat(float v, int16_t num_digits); | ||
|
||
void NN_printShape(Tensor *t); | ||
|
||
void NN_printf(Tensor *t); | ||
|
||
|
||
#endif // __NN_PRINT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.