Skip to content

Conversation

@rameshkunasi
Copy link
Contributor

Added Dynamic_Update_Slice operator changes.

BUG=fixes #3217

@rameshkunasi rameshkunasi requested a review from a team as a code owner October 28, 2025 12:17
Copy link
Collaborator

@veblush veblush left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! I just have a few small comments to address.

}
}

// TODO(rameshkunasi): Add quantized test for dynamic update slice.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you planning to add this in the separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for finding this. For this kernel quantized test is not required. Added remaining test


// min/max are used to compute scale, zero-point is 0
template <size_t kInputSize>
struct TestDynamicUpdateSliceParams {
Copy link
Collaborator

Choose a reason for hiding this comment

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

How do you use this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not useful. Removed

namespace testing {
namespace {

// constexpr float kTestTolerance = 7.41e-03;
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not required. Removed

kInputDims_0, kInputDims_1, kInputDims_2};
int kOutputDims[] = {2, 3, 3};

constexpr float kInput_0[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe I missed something here; The dimension for this is defined {2, 3, 3} above but the array here only has 9 elements? Where is the remaining half?

Copy link
Member

@ddavis-2015 ddavis-2015 Nov 3, 2025

Choose a reason for hiding this comment

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

@veblush kOutputDims is a stand-in array for TfLiteIntArray. The first element of the array is the number of array elements. This occurs throughout the unit tests (using IntArrayFromInts). TfLiteFloatArray is even hairier as the first element of the float array has to be rewritten as an int by FloatArrayFromFloats...

TF_LITE_ENSURE(context,
SizeOfDimension(update, i) <= SizeOfDimension(operand, i));
}
output->type = operand->type;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm curious what's the purpose of this? Output tensor will be deallocated right away?

Copy link
Member

Choose a reason for hiding this comment

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

@rameshkunasi I am also curious as to why the output tensor type is not already set by the TfLiteConverter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for pointing this. Not required, removed this

output_data);
}

TF_LITE_MICRO_TEST(DynamicUpdateSliceOpTestBoundaryTest) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the purpose of this test? How is this different from DynamicUpdateSliceOpTestSimpleFloat?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is same as DynamicUpdateSliceOpTestSimpleFloat except the indices. Here in this test indices used are corner case

Comment on lines 55 to 57
if (current_dim == max_dims) {
return kTfLiteOk;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess this is unreachable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will, because it will be called by increasing current_dim count in recursively

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Porting Dynamic_Update_Slice operator from TFLite to TFLM

4 participants