diff --git a/compiler/fm-equalize-value-py-test/exclude.me b/compiler/fm-equalize-value-py-test/exclude.me new file mode 100644 index 00000000000..e69de29bb2d diff --git a/compiler/luci/import/src/ImporterEx.cpp b/compiler/luci/import/src/ImporterEx.cpp index d4bbc71de56..88b125f1657 100644 --- a/compiler/luci/import/src/ImporterEx.cpp +++ b/compiler/luci/import/src/ImporterEx.cpp @@ -25,6 +25,14 @@ namespace luci { +namespace +{ + +// limitation of current flatbuffers file size +inline constexpr uint64_t FLATBUFFERS_SIZE_MAX = 2147483648UL; // 2GB + +} // namespace + std::unique_ptr ImporterEx::importVerifyModule(const std::string &input_path) const { foder::FileLoader file_loader{input_path}; @@ -43,11 +51,14 @@ std::unique_ptr ImporterEx::importVerifyModule(const std::string &input_ auto data_data = reinterpret_cast(model_data.data()); auto data_size = model_data.size(); - flatbuffers::Verifier verifier{data_data, data_size}; - if (!circle::VerifyModelBuffer(verifier)) + if (data_size < FLATBUFFERS_SIZE_MAX) { - std::cerr << "ERROR: Invalid input file '" << input_path << "'" << std::endl; - return nullptr; + flatbuffers::Verifier verifier{data_data, data_size}; + if (!circle::VerifyModelBuffer(verifier)) + { + std::cerr << "ERROR: Invalid input file '" << input_path << "'" << std::endl; + return nullptr; + } } Importer importer(_source); diff --git a/compiler/luci/service/src/Nodes/CircleReshape.cpp b/compiler/luci/service/src/Nodes/CircleReshape.cpp index a28ad648320..7ae7269f7d0 100644 --- a/compiler/luci/service/src/Nodes/CircleReshape.cpp +++ b/compiler/luci/service/src/Nodes/CircleReshape.cpp @@ -91,6 +91,11 @@ loco::TensorShape Algorithm::visit(const luci::CircleReshape *node) { shape_by_input.dim(axis).unset(); } + else if (const_shape_node->at(axis) == 0) + { + // Assume 0 as 1 + shape_by_input.dim(axis).set(1); + } } } else @@ -148,7 +153,7 @@ loco::TensorShape Algorithm::visit(const luci::CircleReshape *node) } for (uint32_t dim_index = 0; dim_index < output_shape.rank(); ++dim_index) { - const uint32_t dim_value = output_shape.dim(dim_index).value(); + uint32_t dim_value = output_shape.dim(dim_index).value(); if (not output_shape.dim(dim_index).known()) { LUCI_ASSERT(unknown_dim_index == UINT32_MAX, "More than one unknown dimension"); @@ -156,6 +161,8 @@ loco::TensorShape Algorithm::visit(const luci::CircleReshape *node) } else { + if (!dim_value) + dim_value = 1; output_element_count *= dim_value; } }