Skip to content

Commit

Permalink
document (need figure update)
Browse files Browse the repository at this point in the history
  • Loading branch information
hseok-oh committed Sep 2, 2024
1 parent 355151b commit 6fd4c47
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 54 deletions.
43 changes: 2 additions & 41 deletions docs/howto/how-to-introduce-a-new-operation-into-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ onert support the operation.
- [How To Introduce a New Operation Into Runtime](#how-to-introduce-a-new-operation-into-runtime)
- [Index](#index)
- [Core](#core)
- [Frontend](#frontend)
- [Loaders](#loaders)
- [Base Loader](#base-loader)
- [TFLite Loader](#tflite-loader)
- [Circle Loader](#circle-loader)
- [NNAPI](#nnapi)
- [Backend](#backend)
- [ShapeFixer](#shapefixer)
- [acl_cl](#acl_cl)
Expand Down Expand Up @@ -232,12 +230,10 @@ void DynamicShapeInferer::visit(const ir::operation::Select &op)
}
```
## Frontend
This module generates IR from a model. There are two kinds of frontend: Loader and NNAPI. First, Loader loads a model file and generates IR from it. Second, NNAPI generates IR from a model set via [Neural Networks API of android](https://developer.android.com/ndk/guides/neuralnetworks)
### Loaders
This module generates IR from a model.
#### Base Loader
This is where the common parts of loaders are implemented.
Expand Down Expand Up @@ -275,41 +271,6 @@ If you want new operation to be loaded on only TFLite Loader, you only need to i
This loads a circle file generated by the compiler.
If you want new operation to be loaded on only Circle Loader, you only need to implement loading the operation here.

### NNAPI

1. Add to the OperationFactory to generate IR of new operation
- [OperationFactory](/runtime/onert/api/nnapi/wrapper/OperationFactory.cc)

```cpp
_map[ANEURALNETWORKS_SELECT] = [](const OperationFactory::Param &init_param, Operands &) {
assert(init_param.input_count == 3 && init_param.output_count == 1);

OperandIndexSequence outputs{init_param.outputs[0]};

// Each input should be interpreted as follows:
//
// 0 -> Cond Tensor Index
// 1 -> Input1 Tensor Index
// 2 -> Input2 Tensor Index
OperandIndexSequence inputs;
for (uint32_t n = 0; n < init_param.input_count; ++n)
{
inputs.append(OperandIndex{init_param.inputs[n]});
}

return new operation::Select{inputs, outputs};
};
```
2. If you want that NNAPI supports new operation of TFLite's model, you need to update the things related to the operation in [nnapi_delegate](/runtime/libs/tflite/port/1.13.1/src/nnapi_delegate.cpp) like below
```cpp
case tflite::BuiltinOperator_SELECT:
nnapi_version = 12; // require NNAPI 1.2
nn_op_type = ANEURALNETWORKS_SELECT;
break;
```

## Backend

This module generates kernels and tensors of backend such as [ComputeLibrary](https://github.com/ARM-software/ComputeLibrary/) from generated graph-based IR. For this, the runtime fairly works on it internally. But this is not enough because of dependence on backend. So, there are several components that require additional implementation on each backend.
Expand Down
5 changes: 0 additions & 5 deletions docs/howto/how-to-use-nnapi-binding.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/howto/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ How To
./how-to-run-package.md
./how-to-make-an-application-with-runtime.md
./how-to-use-api.md
./how-to-use-nnapi-binding.md
./how-to-use-nnfw-api.md
./how-to-use-specific-backend.md
./how-to-contribute.md
Expand Down
8 changes: 1 addition & 7 deletions docs/runtime/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ There are three parts - Frontend, Core and Backend. Core works with Frontend and

Frontend API is about from creation/loading the model and

Runtime supports two (frontend) APIs - NN API and NNFW API.

### NN API

NN API stands for Android Neural Networks API. It is part of Android Open Source Project and we provide a binding between NN API and One Runtime.

For usage, refer to [Howto : NN API](../howto/how-to-use-nnapi-binding.md).
Runtime supports NNFW API.

### NNFW API

Expand Down

0 comments on commit 6fd4c47

Please sign in to comment.