Fix for build errors with constexpr TfLiteIntArray.

PiperOrigin-RevId: 313599824
Change-Id: Ia37465dd2f782e234839bdfbe991516d9fc06c40
This commit is contained in:
A. Unique TensorFlower 2020-05-28 09:18:29 -07:00 committed by TensorFlower Gardener
parent baeada76cf
commit 290487b03e

View File

@ -46,9 +46,14 @@ struct AllocationInfo {
// requirement for SIMD extensions.
constexpr int kBufferAlignment = 16;
// Static instance of a zero-length int to pass as tensor dims for a flatbuffer
// Tensor with no shape.
constexpr TfLiteIntArray kZeroLengthIntArray = {0, {}};
// Instance of a zero-length int to pass as tensor dims for a flatbuffer
// Tensor with no shape. Note that the second member of a TfLiteArray is a
// flexible array member, which is not strictly valid C++. However it is
// supported by both GCC and clang, as long as the flexible array element is not
// initialized, which is ok in this case as it should never be accessed.
// Declaring this as constexpr causes build errors with clang, as it requires
// the flexible array element to be initialized.
const TfLiteIntArray kZeroLengthIntArray = {0};
class MicroBuiltinDataAllocator : public BuiltinDataAllocator {
public: