Vengineerの妄想(準備期間)

人生は短いけど、長いです。人生を楽しみましょう!

TensorFlow Liteでカスタムオペレータを


TensorFlow Liteって、custon operators が書けるのね。。。


  typedef struct {
    void* (*init)(TfLiteContext* context, const char* buffer, size_t length);
    void (*free)(TfLiteContext* context, void* buffer);
    TfLiteStatus (*prepare)(TfLiteContext* context, TfLiteNode* node);
    TfLiteStatus (*invoke)(TfLiteContext* context, TfLiteNode* node);
  } TfLiteRegistration;

初期化のinit、後処理のfree、前準備のprepareで、実行のinvoke。。。

そして、
namespace tflite {
namespace ops {
namespace custom {
  TfLiteRegistration* Register_MY_CUSTOM_OP() {
    static TfLiteRegistration r = {my_custom_op::Init,
                                   my_custom_op::Free,
                                   my_custom_op::Prepare,
                                   my_custom_op::Eval};
    return &r;
  }
}  // namespace custom
}  // namespace ops
}  // namespace tflite

って感じに、登録すると。

AArch64でも TensorFlow Liteは動くようなので、
FPGA部にカスタムロジック作って、このカスタムロジックを使うカスタムオペレータを作れるかな?