그냥 손에 익숙한(!) v2.4.1을 써서 그런가(구버전 api라서?)

해당 함수가 존재하지 않는다고 에러가 발생하고 빌드에 실패한다.

classify.cc:177:73: error: no matching function for call to ‘tflite::Interpreter::ModifyGraphWithDelegate(<brace-enclosed initializer list>)’
   interpreter->ModifyGraphWithDelegate({delegate, edgetpu_free_delegate});
                                                                         ^
In file included from classify.cc:12:
/home/pi/work/coral/tensorflow/tensorflow/lite/interpreter.h:421:16: note: candidate: ‘TfLiteStatus tflite::Interpreter::ModifyGraphWithDelegate(TfLiteDelegate*)’
   TfLiteStatus ModifyGraphWithDelegate(TfLiteDelegate* delegate);
                ^~~~~~~~~~~~~~~~~~~~~~~
/home/pi/work/coral/tensorflow/tensorflow/lite/interpreter.h:421:16: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘TfLiteDelegate*’
/home/pi/work/coral/tensorflow/tensorflow/lite/interpreter.h:431:23: note: candidate: ‘template<class Delegate, class Deleter> TfLiteStatus tflite::Interpreter::ModifyGraphWithDelegate(std::unique_ptr<_Tp, _Dp>)’
   inline TfLiteStatus ModifyGraphWithDelegate(
                       ^~~~~~~~~~~~~~~~~~~~~~~
/home/pi/work/coral/tensorflow/tensorflow/lite/interpreter.h:431:23: note:   template argument deduction/substitution failed:
classify.cc:177:73: note:   couldn't deduce template parameter ‘Delegate’
   interpreter->ModifyGraphWithDelegate({delegate, edgetpu_free_delegate});

 

검색해보니 c++x00

 

class Example {
  private:
  public:
    Example(std::initializer_list<int> list) {
    }
};

Example exam = {10,10,10,10,10};

[링크 : https://forum.arduino.cc/t/how-to-make-brace-enclosed-initializer-list-constructor/628295]

 

Phenotype(std::initializer_list<uint8> c) {
  assert(c.size() <= std::size(m_array));
  std::copy(c.begin(), c.end(), m_array);
}

// used like
Phenotype p1{1, 2, 3};
Phenotype p2({1, 3, 2}); // works too
Phenotype p3(1, 2, 3); // doesn't work

[링크 : https://stackoverflow.com/questions/4118025/brace-enclosed-initializer-list-constructor]

 

그나저나 api 문서가 업데이트 늦을수도 있지만

아래의 원형밖에 없는데 std::unique_ptr이 std::initializer_list일 리는 없을테고. 도대체 어떤 함수를 써야 하는걸까?

TfLiteStatus ModifyGraphWithDelegate(
  TfLiteDelegate *delegate
)

TfLiteStatus ModifyGraphWithDelegate(
  std::unique_ptr< Delegate, Deleter > delegate
)

TfLiteStatus ModifyGraphWithDelegate(
  std::unique_ptr< TfLiteDelegate > delegate
)=delete

[링크 : https://www.tensorflow.org/lite/api_docs/cc/class/tflite/interpreter#modifygraphwithdelegate_1]

'프로그램 사용 > google coral' 카테고리의 다른 글

google coral with tpu, python  (0) 2022.02.07
edgetpu_c.h 파일 내용 분석  (0) 2022.02.07
google coral, tpu yolo  (0) 2022.01.27
coral tpu delegate example  (0) 2022.01.25
google coral, ubuntu 18.04  (0) 2020.10.20
Posted by 구차니