wemosでnnc

#概要

wemosでnncやってみた。
xorを予測してみた。
nncで学習したnnbを使った。


#結果


```
start 
ok0
ok1
ok2
NNB: Version: [2]
NNB: Has 2 buffers.
NNB: Buffer id:0 size:100
NNB: Buffer id:1 size:100
NNB: Has 8 variables.
NNB: Variable id:              0
NNB: Variable shape:           ( 1 2 )
NNB: Variable type:            0
NNB: Variable fp_pos:          0
NNB: Variable data_index: Buffer[0]
NNB: Variable id:              1
NNB: Variable shape:           ( 2 100 )
NNB: Variable type:            0
NNB: Variable fp_pos:          0
NNB: Variable data_index: 6
NNB: Variable id:              2
NNB: Variable shape:           ( 100 )
NNB: Variable type:            0
NNB: Variable fp_pos:          0
NNB: Variable data_index: 9
NNB: Variable id:              3
NNB: Variable shape:           ( 100 1 )
NNB: Variable type:            0
NNB: Variable fp_pos:          0
NNB: Variable data_index: 12
NNB: Variable id:              4
NNB: Variable shape:           ( 1 )
NNB: Variable type:            0
NNB: Variable fp_pos:          0
NNB: Variable data_index: 15
NNB: Variable id:              5
NNB: Variable shape:           ( 1 100 )
NNB: Variable type:            0
NNB: Variable fp_pos:          0
NNB: Variable data_index: Buffer[1]
NNB: Variable id:              6
NNB: Variable shape:           ( 1 100 )
NNB: Variable type:            0
NNB: Variable fp_pos:          0
NNB: Variable data_index: Buffer[0]
NNB: Variable id:              7
NNB: Variable shape:           ( 1 1 )
NNB: Variable type:            0
NNB: Variable fp_pos:          0
NNB: Variable data_index: Buffer[1]
NNB: Has 3 functions.
NNB: Has 1 inputs.
NNB: Input[0]        Variable id:0
NNB: Has 1 outputs.
NNB: Output[0] Variable id:7
                                     0
ok4
ok5
ok6
0 0 =
0.24
1 0 =
0.83
0 1 =
0.75
1 1 =
0.23
0
ok8
```

#使用したライブラリー

https://github.com/sony/nnabla-c-runtime

#サンプルコード


```
#include "network.h"
#include "runtime.h"
#include "runtime_internal.h"
#include "context.h"
#include <assert.h>
#include <string.h>

static unsigned char xor_nnb[] = {
 0x02, 0x00, 0x00, 0x00, 0x10, 0x95, 0xFB, 0x06, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
 0x22, 0x00, 0x00, 0x00, 0xC8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00,
 0x34, 0x00, 0x00, 0x00, 0x54, 0x03, 0x00, 0x00, 0x68, 0x03, 0x00, 0x00, 0x6C, 0x03, 0x00, 0x00,
 0xFC, 0x04, 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x18, 0x05, 0x00, 0x00, 0xA8, 0x06, 0x00, 0x00,
 0xBC, 0x06, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0xC4, 0x06, 0x00, 0x00, 0xD8, 0x06, 0x00, 0x00,
 0xE0, 0x06, 0x00, 0x00, 0xF4, 0x06, 0x00, 0x00, 0xFC, 0x06, 0x00, 0x00, 0x10, 0x07, 0x00, 0x00,
 0x18, 0x07, 0x00, 0x00, 0x2C, 0x07, 0x00, 0x00, 0x4C, 0x07, 0x00, 0x00, 0x58, 0x07, 0x00, 0x00,
 0x5C, 0x07, 0x00, 0x00, 0x74, 0x07, 0x00, 0x00, 0x78, 0x07, 0x00, 0x00, 0x7C, 0x07, 0x00, 0x00,
 0x94, 0x07, 0x00, 0x00, 0xA0, 0x07, 0x00, 0x00, 0xA4, 0x07, 0x00, 0x00, 0xBC, 0x07, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0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E,
 0xF4, 0xFC, 0x93, 0xBD, 0x11, 0x63, 0x5D, 0x3E, 0x33, 0x14, 0x57, 0x3D, 0x78, 0x4A, 0x63, 0x3E,
 0xE8, 0x2F, 0xD9, 0xBD, 0x4A, 0x41, 0xB8, 0x3E, 0x18, 0xCD, 0xC6, 0x3D, 0xED, 0xC5, 0x4E, 0x3E,
 0xC3, 0x02, 0xB5, 0xBD, 0x34, 0x93, 0xC8, 0xBD, 0x74, 0x7D, 0xF4, 0x3E, 0x47, 0x04, 0xD0, 0xBD,
 0x86, 0x02, 0xA4, 0xBD, 0xFE, 0x3C, 0x8D, 0x3E, 0xBC, 0x74, 0x28, 0x3D, 0x9A, 0xAB, 0xBF, 0x3D,
 0x2F, 0xC6, 0x51, 0xBD, 0xE2, 0xB4, 0x98, 0x3D, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
 0xBD, 0x4D, 0x42, 0x3D, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0xFE, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00,
 0x07, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
 0x12, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00,
 0x1D, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00
};
static float input0[] = {
	0, 0
};
static float input1[] = {
	1, 0
};
static float input2[] = {
	0, 1
};
static float input3[] = {
	1, 1
};
void dump(nn_network_t * net)
{
	unsigned int i,
		j;
	char work[40];
	sprintf(work, "NNB: Version: [%d]\n", net->version);
	Serial.print(work);
	sprintf(work, "NNB: Has %d buffers.\n", net->buffers.size);
	Serial.print(work);
	int * list = (int *) NN_GET(net, net->buffers.list);
	for (i = 0; i < net->buffers.size; i++)
	{
		sprintf(work, "NNB: Buffer id:%d size:%d\n", i, * (list + i));
		Serial.print(work);
	}
	sprintf(work, "NNB: Has %d variables.\n", net->variables.size);
	Serial.print(work);
	list = (int *) NN_GET(net, net->variables.list);
	for (i = 0; i < net->variables.size; i++)
	{
		nn_variable_t * var = (nn_variable_t *) (NN_GET(net, * (list + i)));
		sprintf(work, "NNB: Variable id:				 %d\n", var->id);
		Serial.print(work);
		sprintf(work, "NNB: Variable shape:			(");
		Serial.print(work);
		int * shape_list = (int *) NN_GET(net, var->shape.list);
		for (j = 0; j < var->shape.size; j++)
		{
			sprintf(work, " %d", *(shape_list + j));
			Serial.print(work);
		}
		sprintf(work, " )\n");
		Serial.print(work);
		sprintf(work, "NNB: Variable type:			 %d\n", var->type);
		Serial.print(work);
		sprintf(work, "NNB: Variable fp_pos:		 %d\n", var->fp_pos);
		Serial.print(work);
		if (var->data_index < 0)
		{
			sprintf(work, "NNB: Variable data_index: Buffer[%d]\n", (-1 * var->data_index) - 1);
			Serial.print(work);
		}
		else
		{
			sprintf(work, "NNB: Variable data_index: %d\n", var->data_index);
			Serial.print(work);
		}
	}
	sprintf(work, "NNB: Has %d functions.\n", net->functions.size);
	Serial.print(work);
	list = (int *) NN_GET(net, net->functions.list);
	for (i = 0; i < net->functions.size; i++)
	{
		//dump_function(net, (nn_function_t *)(NN_GET(net, * (list + i))));
	}
	sprintf(work, "NNB: Has %d inputs.\n", net->inputs.size);
	Serial.print(work);
	list = (int *) NN_GET(net, net->inputs.list);
	for (i = 0; i < net->inputs.size; i++)
	{
		sprintf(work, "NNB: Input[%d]	 Variable id:%d\n", i, * (list + i));
		Serial.print(work);
	}
	sprintf(work, "NNB: Has %d outputs.\n", net->outputs.size);
	Serial.print(work);
	list = (int *) NN_GET(net, net->outputs.list);
	for (i = 0; i < net->outputs.size; i++)
	{
		sprintf(work, "NNB: Output[%d]	Variable id:%d\n", i, * (list + i));
		Serial.print(work);
	}
}
void setup()
{
	Serial.begin(9600);
	Serial.println("start");
	rt_context_pointer context = 0;
	rt_return_value_t ret = rt_allocate_context(&context);
	assert(ret == RT_RET_NOERROR);
	Serial.println("ok0");
	Serial.println("ok1");
	nn_network_t * net = (nn_network_t *) xor_nnb;
	Serial.println("ok2");
	dump(net);
	ret = rt_initialize_context(context, net);
	assert(ret == RT_RET_NOERROR);
	Serial.println("ok4");
	Serial.println("ok5");
	Serial.println("ok6");
	memcpy(rt_input_buffer(context, 0), input0, sizeof(input0));
	ret = rt_forward(context);
	Serial.println("0 0 = ");
	float * probs = (float *) rt_output_buffer(context, 0);
	Serial.println(probs[0]);
	assert(ret == RT_RET_NOERROR);
	memcpy(rt_input_buffer(context, 0), input1, sizeof(input0));
	ret = rt_forward(context);
	Serial.println("1 0 = ");
	probs = (float *) rt_output_buffer(context, 0);
	Serial.println(probs[0]);
	assert(ret == RT_RET_NOERROR);
	memcpy(rt_input_buffer(context, 0), input2, sizeof(input0));
	ret = rt_forward(context);
	Serial.println("0 1 = ");
	probs = (float *) rt_output_buffer(context, 0);
	Serial.println(probs[0]);
	assert(ret == RT_RET_NOERROR);
	memcpy(rt_input_buffer(context, 0), input3, sizeof(input0));
	ret = rt_forward(context);
	Serial.println("1 1 = ");
	probs = (float *) rt_output_buffer(context, 0);
	Serial.println(probs[0]);
	assert(ret == RT_RET_NOERROR);
	ret = rt_free_context(&context);
	Serial.println(ret);
	assert(ret == RT_RET_NOERROR);
	Serial.println("ok8");
}
void loop()
{
	delay(300);
}

```

#ツール

nnbファイルをｃソースにする、ツールを作った。

https://embed.plnkr.co/xaQPvPFmNOVuk42TxHpA/


以上。