Skip to content

Commit

Permalink
Relax subgraph byte constraint to required_bytes <= bytes rather th…
Browse files Browse the repository at this point in the history
…an exact match.

This has been an error raised for some issues [github example](#14929).

If the required bytes are covered by the current model, there is no need to raise an error due to exact size mismatch on user's side.

PiperOrigin-RevId: 621699856
  • Loading branch information
chococigar authored and tensorflower-gardener committed Apr 4, 2024
1 parent a246f9e commit 8d698c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tensorflow/lite/core/subgraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ TfLiteStatus Subgraph::SetTensorParametersReadOnly(
TF_LITE_ENSURE_OK(
&context_,
tflite::BytesRequired(type, dims, ndims, &required_bytes, &context_));
TF_LITE_ENSURE_EQ(&context_, required_bytes, bytes);
TF_LITE_ENSURE(&context_, required_bytes <= bytes);
}

TfLiteTensor& tensor = context_.tensors[tensor_index];
Expand Down

0 comments on commit 8d698c3

Please sign in to comment.