Ejemplo n.º 1
0
def test_simple_conv2d_transpose():
    ncc.clear()
    ncc.save_tflite(module)
    init_values()
    ncc.compile(['--inference-type', 'float', '-t', 'cpu'])

    ncc.infer(['--dataset-format', 'raw'])
    ncc.close_to('test', 0)
Ejemplo n.º 2
0
def test_slice():
	ncc.clear()
	ncc.save_tflite(module)
	init_values()
	ncc.compile(['--inference-type', 'float'])

	ncc.infer(['--dataset-format', 'raw'])
	ncc.close_to('test', 0)
Ejemplo n.º 3
0
def test_simple():
    ncc.clear()
    ncc.copy_tflite('../examples/20classes_yolo/model/20classes_yolo.tflite')
    init_values()
    ncc.compile(
        ['--inference-type', 'float', '--max-allocator-solve-secs', '0'])

    ncc.infer(['--dataset-format', 'raw'])
    ncc.close_to('test', 1e-6)
Ejemplo n.º 4
0
def test_simple_matmul_quant():
	ncc.clear()
	ncc.save_tflite(module)
	init_values()
	ncc.compile(['--inference-type', 'uint8', '-t', 'cpu',
	 '--dataset', ncc.input_dir + '/test.bin', '--dataset-format', 'raw',
	 '--input-type', 'float'])

	ncc.infer(['--dataset-format', 'raw'])
	ncc.close_to('test', 1e-3)
Ejemplo n.º 5
0
def test_add(input):
    ncc.clear()

    ncc.save_input_array('test', input)
    onnx_importer.utils.save(module, torch.from_numpy(input))
    ncc.save_expect_array('test', onnx_importer.utils.run(input))

    onnx_importer.utils.compile(['--inference-type', 'float'])

    ncc.infer(['--dataset-format', 'raw'])
    ncc.close_to('test', 0)
Ejemplo n.º 6
0
def test_simple_conv2d_k210():
    ncc.clear()
    ncc.save_tflite(module)
    init_values()
    ncc.compile([
        '--inference-type', 'uint8', '-t', 'k210', '--dataset',
        ncc.input_dir + '/test.bin', '--dataset-format', 'raw', '--input-type',
        'float'
    ])

    ncc.infer(['--dataset-format', 'raw'])
    ncc.close_to('test', 0.4)
Ejemplo n.º 7
0
def test_simple_k210():
    ncc.clear()
    ncc.copy_tflite('../examples/20classes_yolo/model/20classes_yolo.tflite')
    init_values()
    ncc.compile([
        '--inference-type', 'uint8', '-t', 'k210', '--dataset',
        ncc.input_dir + '/test.bin', '--dataset-format', 'raw', '--input-type',
        'float', '--max-allocator-solve-secs', '0'
    ])

    ncc.infer(['--dataset-format', 'raw'])
    ncc.close_to('test', 1.3)
Ejemplo n.º 8
0
def test_matmul_quant(input):
    ncc.clear()

    ncc.save_input_array('test', input)
    onnx_importer.utils.save(module, torch.from_numpy(input))
    ncc.save_expect_array('test', onnx_importer.utils.run(input))

    onnx_importer.utils.compile(['--inference-type', 'uint8', '-t', 'cpu',
     '--dataset', ncc.input_dir + '/test.bin', '--dataset-format', 'raw',
     '--input-type', 'float'])

    ncc.infer(['--dataset-format', 'raw'])
    ncc.close_to('test', 0.005)
Ejemplo n.º 9
0
def test_clip_k210_onnx_9(input):
    ncc.clear()

    ncc.save_input_array('test', input)
    onnx_importer.utils.save(module, torch.from_numpy(input), opset_version=9)
    ncc.save_expect_array('test', onnx_importer.utils.run(input))

    onnx_importer.utils.compile(['--inference-type', 'uint8', '-t', 'k210',
     '--dataset', ncc.input_dir + '/test.bin', '--dataset-format', 'raw',
     '--input-type', 'float'])

    ncc.infer(['--dataset-format', 'raw'])
    ncc.close_to('test', 0.05)