Automated sync from github.com/tensorflow/tensorflow#3525
Open
TFLM-bot wants to merge 1 commit into
Open
Conversation
veblush
previously approved these changes
Apr 10, 2026
0b5b197 to
e19075b
Compare
0c5e034 to
3af5d7d
Compare
fded1da to
e721b72
Compare
c023a0d to
40fe510
Compare
7ff979f to
7b05eb3
Compare
5ca850f to
ae9ea58
Compare
ddavis-2015
reviewed
Jun 18, 2026
Member
There was a problem hiding this comment.
Doesn't the second check against MAX_DIM seem redundant?
ddavis-2015
reviewed
Jun 18, 2026
| }; | ||
|
|
||
| constexpr int kTransposeMaxDimensions = 6; | ||
| constexpr int kTransposeMaxDimensions = 8; |
Member
There was a problem hiding this comment.
Not compatible with kMaxSmallSize from runtime_shape.h
ddavis-2015
reviewed
Jun 18, 2026
Comment on lines
+598
to
+618
| TfLiteStatus CheckedShapeProduct(TfLiteContext* context, | ||
| absl::Span<const int> dims, | ||
| const char* error_message, size_t& product) { | ||
| // The CheckedNumElements function already checks for negative dimensions, so | ||
| // we don't do it here. | ||
| TF_LITE_ENSURE_MSG(context, CheckedNumElements(dims, product) == kTfLiteOk, | ||
| "%s", error_message); | ||
| return kTfLiteOk; | ||
| } | ||
|
|
||
| TfLiteStatus CheckedShapeProductToInt(TfLiteContext* context, | ||
| absl::Span<const int> dims, | ||
| const char* error_message, int& product) { | ||
| for (const int dim : dims) { | ||
| TF_LITE_ENSURE_MSG(context, dim >= 0, "Encountered a negative dimension."); | ||
| } | ||
| TF_LITE_ENSURE_MSG(context, CheckedNumElements(dims, product) == kTfLiteOk, | ||
| "%s", error_message); | ||
| return kTfLiteOk; | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
probably requires #ifndef TF_LITE_STATIC_MEMORY fencing
Member
|
requires import of |
ddavis-2015
reviewed
Jun 18, 2026
| #include <string> | ||
| #endif // TF_LITE_STATIC_MEMORY | ||
|
|
||
| #include "absl/types/span.h" |
Member
There was a problem hiding this comment.
probably requires #ifndef TF_LITE_STATIC_MEMORY fencing
ddavis-2015
reviewed
Jun 18, 2026
Comment on lines
+346
to
+369
| /** | ||
| * Calculates the product of the given dimensions. Returns an error if any of | ||
| * the dimensions is negative or if the product overflows. | ||
| * @param context The context to use for error reporting. | ||
| * @param dims The dimensions to multiply. | ||
| * @param error_message The error message to use if an error is encountered. | ||
| * @param product The output parameter to store the product. | ||
| */ | ||
| TfLiteStatus CheckedShapeProduct(TfLiteContext* context, | ||
| absl::Span<const int> dims, | ||
| const char* error_message, size_t& product); | ||
|
|
||
| /** | ||
| * Calculates the product of the given dimensions. Returns an error if any of | ||
| * the dimensions is negative or if the product overflows. | ||
| * @param context The context to use for error reporting. | ||
| * @param dims The dimensions to multiply. | ||
| * @param error_message The error message to use if an error is encountered. | ||
| * @param product The output parameter to store the product. | ||
| */ | ||
| TfLiteStatus CheckedShapeProductToInt(TfLiteContext* context, | ||
| absl::Span<const int> dims, | ||
| const char* error_message, int& product); | ||
|
|
Member
There was a problem hiding this comment.
probably requires #ifndef TF_LITE_STATIC_MEMORY fencing
ae9ea58 to
32b8e82
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream