Skip to content

Commit

Permalink
Merge pull request #69 from sony/feature/20220330-update-api-level-ve…
Browse files Browse the repository at this point in the history
…rsion
  • Loading branch information
YukioOobuchi authored Mar 31, 2022
2 parents 07104a0 + 1cb7ac1 commit 95bc1f3
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 7 deletions.
4 changes: 2 additions & 2 deletions VERSION.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NNABLA_VERSION: 1.26.0.dev1
NNABLA_VERSION: 1.27.0.dev1
C_RUNTIME_VERSION: 1.2.0.dev1_c1
NNB_MINIMUM_VERSION: 2
NNB_VERSION: 3
API_LEVEL: 40
API_LEVEL: 41
17 changes: 17 additions & 0 deletions build-tools/code-generator/functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2968,6 +2968,23 @@ Array Manipulation:
id: 319
func_type:
- ALL
BatchCholesky:
snake_name: batch_cholesky
inputs:
x: {}
arguments:
upper:
type: bool
default: 'False'
outputs:
y: {}
c_runtime: not support
function_ids:
B: 347
uniq_name: BatchCholesky_B
id: 347
func_type:
- ALL
Assign:
snake_name: assign
inputs:
Expand Down
5 changes: 3 additions & 2 deletions doc/SUPPORT_STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# Implement status

Total 62/216
Total 62/217


## Neural Network Layer
Expand Down Expand Up @@ -195,7 +195,7 @@ Count 6/23
| ATanh | no | - | - |

## Array Manipulation
Count 11/30
Count 11/31

| Function | Available | float | generic |
|------------------------------|--------------|--------------|--------------|
Expand All @@ -219,6 +219,7 @@ Count 11/30
| BatchDet | no | - | - |
| BatchInv | no | - | - |
| BatchLogdet | no | - | - |
| BatchCholesky | no | - | - |
| Assign | no | - | - |
| Gather | no | - | - |
| GatherNd | no | - | - |
Expand Down
5 changes: 5 additions & 0 deletions include/nnablart/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@
#define CONFIG_AVERAGEPOOLING_FIXED8 1
#define CONFIG_AVERAGEPOOLING_FLOAT32 1
#define CONFIG_AVERAGEPOOLING_GENERIC 1
#define CONFIG_BATCHCHOLESKY 1
#define CONFIG_BATCHCHOLESKY_FIXED16 1
#define CONFIG_BATCHCHOLESKY_FIXED8 1
#define CONFIG_BATCHCHOLESKY_FLOAT32 1
#define CONFIG_BATCHCHOLESKY_GENERIC 1
#define CONFIG_BATCHDET 1
#define CONFIG_BATCHDET_FIXED16 1
#define CONFIG_BATCHDET_FIXED8 1
Expand Down
19 changes: 19 additions & 0 deletions include/nnablart/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -2861,6 +2861,25 @@ rt_function_error_t free_batch_logdet_local_context(rt_function_t *f);
rt_function_error_t exec_batch_logdet(rt_function_t *f);
/// @}

/// @defgroup BatchCholesky BatchCholesky
/// @{

/// Local context for BatchCholesky
typedef struct {
uint8_t upper; ///< bool
void *data; ///< General purpose data area
} batch_cholesky_local_context_t;

/// Allocate BatchCholesky local context
rt_function_error_t allocate_batch_cholesky_local_context(rt_function_t *f);

/// Free BatchCholesky local context
rt_function_error_t free_batch_cholesky_local_context(rt_function_t *f);

/// Exec BatchCholesky
rt_function_error_t exec_batch_cholesky(rt_function_t *f);
/// @}

/// @defgroup Assign Assign
/// @{

Expand Down
18 changes: 16 additions & 2 deletions include/nnablart/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ extern "C" {
#include <stdint.h> // for fixed bit length integer type
#include <stdlib.h> // for size_t

#define NN_NNABLA_VERSION ("1.26.0.dev1")
#define NN_NNABLA_VERSION ("1.27.0.dev1")
#define NN_C_RUNTIME_VERSION ("1.2.0.dev1_c1")
#define NN_BINARY_FORMAT_MINIMUM_VERSION (2)
#define NN_BINARY_FORMAT_VERSION (3)
#define NN_API_LEVEL (40)
#define NN_API_LEVEL (41)
#define NN_API_LEVEL_MAX (5000)

////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -256,6 +256,7 @@ typedef enum {
NN_FUNCTION_BATCH_DET = 276, ///< BatchDet
NN_FUNCTION_BATCH_INV = 275, ///< BatchInv
NN_FUNCTION_BATCH_LOGDET = 319, ///< BatchLogdet
NN_FUNCTION_BATCH_CHOLESKY = 347, ///< BatchCholesky
NN_FUNCTION_ASSIGN = 248, ///< Assign
NN_FUNCTION_GATHER_0 = 302, ///< Recent version of Gather has arg [iiI]
NN_FUNCTION_GATHER = 303, ///< Gather
Expand Down Expand Up @@ -2361,6 +2362,19 @@ typedef struct {

/// @}

/// @brief BatchCholesky function.
/// @{
typedef struct {
nn_function_type_t type : 16; ///< Common: type of function.
nn_function_implement_t impl : 16; ///< Common: function implementation.
nn_list_t inputs; ///< Common: List of input variables.
nn_list_t outputs; ///< Common: List of output variables.
// End of common part.
uint8_t upper; ///< Original type is [bool]
} nn_function_batch_cholesky_t;

/// @}

/// @brief Assign function.
/// @{
typedef struct {
Expand Down
18 changes: 17 additions & 1 deletion src/functions/implements/unimplemented.c
Original file line number Diff line number Diff line change
Expand Up @@ -1757,6 +1757,22 @@ rt_function_error_t exec_batch_logdet(rt_function_t *f) {
}
#endif /* CONFIG_BATCHLOGDET */

// BatchtCholesky
#ifdef CONFIG_BATCHCHOLESKY
rt_function_error_t allocate_batch_cholesky_local_context(rt_function_t *f) {
f->exec_func = exec_batch_cholesky;
return RT_FUNCTION_ERROR_UNIMPLEMENTED;
}

rt_function_error_t free_batch_cholesky_local_context(rt_function_t *f) {
return RT_FUNCTION_ERROR_UNIMPLEMENTED;
}

rt_function_error_t exec_batch_cholesky(rt_function_t *f) {
return RT_FUNCTION_ERROR_UNIMPLEMENTED;
}
#endif /* CONFIG_BATCHCHOLESKY */

////////////////////////////////////////////////////////////////////////////////
// Stochasticity
////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -2563,4 +2579,4 @@ rt_function_error_t free_patch_correlation_local_context(rt_function_t *f) {
rt_function_error_t exec_patch_correlation(rt_function_t *f) {
return RT_FUNCTION_ERROR_UNIMPLEMENTED;
}
#endif /* CONFIG_PATCHCORRELATION */
#endif /* CONFIG_PATCHCORRELATION */
7 changes: 7 additions & 0 deletions src/nnablart/dump_function.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,9 @@ void dump_function(nn_network_t *net, nn_function_t *func) {
case NN_FUNCTION_BATCH_LOGDET: { // BatchLogdet
printf("NNB: Function type: BatchLogdet(319)\n");
} break;
case NN_FUNCTION_BATCH_CHOLESKY: { // BatchCholesky
printf("NNB: Function type: BatchCholesky(347)\n");
} break;
case NN_FUNCTION_ASSIGN: { // Assign
printf("NNB: Function type: Assign(248)\n");
} break;
Expand Down Expand Up @@ -1621,6 +1624,10 @@ void dump_function(nn_network_t *net, nn_function_t *func) {
} break;
case NN_FUNCTION_BATCH_LOGDET: { // BatchLogdet
} break;
case NN_FUNCTION_BATCH_CHOLESKY: { // BatchCholesky
nn_function_batch_cholesky_t *f = (nn_function_batch_cholesky_t *)func;
printf("NNB: Function argument upper: %d\n", f->upper);
} break;
case NN_FUNCTION_ASSIGN: { // Assign
} break;
case NN_FUNCTION_GATHER: { // Gather
Expand Down
13 changes: 13 additions & 0 deletions src/runtime/function_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -2085,6 +2085,19 @@ void allocate_function_context(nn_network_t *n, nn_function_t *function,
} break;
#endif

#ifdef CONFIG_BATCHCHOLESKY
case NN_FUNCTION_BATCH_CHOLESKY: { // BatchCholesky
function_context->func.free_local_context_func =
free_batch_cholesky_local_context;
nn_function_batch_cholesky_t *f = (nn_function_batch_cholesky_t *)function;
batch_cholesky_local_context_t *ctx =
rt_malloc_func(sizeof(batch_cholesky_local_context_t));
ctx->upper = f->upper;
function_context->func.local_context = ctx;
allocate_batch_cholesky_local_context(&function_context->func);
} break;
#endif

#ifdef CONFIG_ASSIGN
case NN_FUNCTION_ASSIGN: { // Assign
function_context->func.free_local_context_func = free_assign_local_context;
Expand Down

0 comments on commit 95bc1f3

Please sign in to comment.