Skip to content

Automated sync from github.com/tensorflow/tensorflow#3525

Open
TFLM-bot wants to merge 1 commit into
mainfrom
sync-from-upstream-tf
Open

Automated sync from github.com/tensorflow/tensorflow#3525
TFLM-bot wants to merge 1 commit into
mainfrom
sync-from-upstream-tf

Conversation

@TFLM-bot

Copy link
Copy Markdown
Collaborator

BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream

@TFLM-bot TFLM-bot requested a review from a team as a code owner April 10, 2026 14:23
@TFLM-bot TFLM-bot added bot:sync-tf Pull requests generated by the upstream TensorFlow sync process. ci:ready Triggers the basic TFLM test suite. labels Apr 10, 2026
@TFLM-bot TFLM-bot requested a review from suleshahid April 10, 2026 14:23
veblush
veblush previously approved these changes Apr 10, 2026
@TFLM-bot TFLM-bot force-pushed the sync-from-upstream-tf branch from 0b5b197 to e19075b Compare April 22, 2026 14:33
@TFLM-bot TFLM-bot force-pushed the sync-from-upstream-tf branch 2 times, most recently from 0c5e034 to 3af5d7d Compare May 7, 2026 14:53
@TFLM-bot TFLM-bot force-pushed the sync-from-upstream-tf branch 2 times, most recently from fded1da to e721b72 Compare May 22, 2026 14:59
@TFLM-bot TFLM-bot force-pushed the sync-from-upstream-tf branch 5 times, most recently from c023a0d to 40fe510 Compare June 2, 2026 15:19
@TFLM-bot TFLM-bot force-pushed the sync-from-upstream-tf branch 6 times, most recently from 7ff979f to 7b05eb3 Compare June 10, 2026 15:02
@TFLM-bot TFLM-bot force-pushed the sync-from-upstream-tf branch 4 times, most recently from 5ca850f to ae9ea58 Compare June 17, 2026 15:02

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the second check against MAX_DIM seem redundant?

};

constexpr int kTransposeMaxDimensions = 6;
constexpr int kTransposeMaxDimensions = 8;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not compatible with kMaxSmallSize from runtime_shape.h

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;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably requires #ifndef TF_LITE_STATIC_MEMORY fencing

@ddavis-2015

Copy link
Copy Markdown
Member

requires import of tensorflow/lite/kernels/internal/reference/broadcast_loop.h

#include <string>
#endif // TF_LITE_STATIC_MEMORY

#include "absl/types/span.h"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably requires #ifndef TF_LITE_STATIC_MEMORY fencing

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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably requires #ifndef TF_LITE_STATIC_MEMORY fencing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:sync-tf Pull requests generated by the upstream TensorFlow sync process. ci:ready Triggers the basic TFLM test suite.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants