-
Notifications
You must be signed in to change notification settings - Fork 170
Open
Labels
Description
ReshapeOp from ONNX has 0 and from this value, luci-interpreter halts without message.
maybe by divide by zero error.
static void resolveUnknownDimension(const Shape &input_shape, Shape *output_shape)
{
const int32_t num_input_elements = input_shape.num_elements();
int32_t num_output_elements = 1;
int unknown_dim_index = -1;
for (int i = 0; i < output_shape->num_dims(); ++i)
{
const int32_t value = output_shape->dim(i);
if (value == -1)
{
assert(unknown_dim_index == -1);
unknown_dim_index = i;
}
else
{
num_output_elements *= value;
}
}
if (unknown_dim_index != -1)
{
output_shape->dim(unknown_dim_index) = num_input_elements / num_output_elements; <-----------
num_output_elements *= output_shape->dim(unknown_dim_index);
}what to do
- throw with there's a 0 in shape message
- treat 0 like the ONNX does
