Use ExternalData for object with no value (nullptr buffer from setOperandValue)
Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
const internal::tflite::operand::Index ind{index};
auto &obj = model->deref().operands().at(ind);
- using internal::tflite::operand::CachedData;
-
- obj.data<CachedData>(reinterpret_cast<const uint8_t *>(buffer), length);
+ if (buffer == nullptr)
+ {
+ using internal::tflite::operand::ExternalData;
+ obj.data<ExternalData>(reinterpret_cast<const uint8_t *>(buffer), length);
+ }
+ else
+ {
+ using internal::tflite::operand::CachedData;
+ obj.data<CachedData>(reinterpret_cast<const uint8_t *>(buffer), length);
+ }
return ANEURALNETWORKS_NO_ERROR;
}