10BC0 Remove use_simple_allocator arguments to BuildInterpreter by copybara-service[bot] · Pull Request #112152 · tensorflow/tensorflow · GitHub
[go: up one dir, main page]

Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tensorflow/lite/kernels/cast_test_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ class CastOpModel : public SingleOpModel {
CreateCastOptions(builder_).Union());
BuildInterpreter({GetShape(input_)}, /*num_threads=*/-1,
/*allow_fp32_relax_to_fp16=*/false,
/*apply_delegate=*/true, /*allocate_and_delegate=*/false,
/*use_simple_allocator=*/false);
/*apply_delegate=*/true, /*allocate_and_delegate=*/false);
InterpreterOptions options;
options.SetCacheConstantCastOp(true);
interpreter_->ApplyOptions(&options);
Expand Down
3 changes: 1 addition & 2 deletions tensorflow/lite/kernels/stablehlo_case_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ class StablehloCaseOpModel : public SingleOpModel {
.Union());
BuildInterpreter({GetShape(input_)}, /*num_threads=*/-1,
/*allow_fp32_relax_to_fp16=*/false,
/*apply_delegate=*/false, /*allocate_and_delegate=*/false,
/*use_simple_allocator=*/false);
/*apply_delegate=*/false, /*allocate_and_delegate=*/false);
AddSubgraphs(params.num_branches);
}

Expand Down
3 changes: 1 addition & 2 deletions tensorflow/lite/kernels/stablehlo_pad_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ class StablehloPadModel : public SingleOpModel {
/*input_shapes=*/{std::vector<int>(input_.shape.begin(),
input_.shape.end())},
/*num_threads=*/-1, /*allow_fp32_relax_to_fp16=*/false,
/*apply_delegate=*/true, /*allocate_and_delegate=*/false,
/*use_simple_allocator=*/false);
/*apply_delegate=*/true, /*allocate_and_delegate=*/false);
AllocateAndDelegate(/*apply_delegate=*/true);
PopulateTensor(input_tensor_id_, input_.data);
return absl::OkStatus();
Expand Down
3 changes: 1 addition & 2 deletions tensorflow/lite/kernels/stablehlo_reduce_window_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ class ReduceWindowOpModel : public SingleOpModel {
/*input_shapes=*/{std::vector<int>(input_shape_.begin(),
input_shape_.end())},
/*num_threads=*/-1, /*allow_fp32_relax_to_fp16=*/false,
/*apply_delegate=*/true, /*allocate_and_delegate=*/false,
/*use_simple_allocator=*/false);
/*apply_delegate=*/true, /*allocate_and_delegate=*/false);

int body_subgraph_index;
AddSubgraphs(1, &body_subgraph_index);
Expand Down
3 changes: 1 addition & 2 deletions tensorflow/lite/kernels/stablehlo_scatter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ class StablehloScatterOpModel : public SingleOpModel {
.Union());
BuildInterpreter({GetShape(input_), GetShape(indices_), GetShape(updates_)},
/*num_threads=*/-1, /*allow_fp32_relax_to_fp16=*/false,
/*apply_delegate=*/false, /*allocate_and_delegate=*/false,
/*use_simple_allocator=*/false);
/*apply_delegate=*/false, /*allocate_and_delegate=*/false);

int* dummy = nullptr;
AddSubgraphs(1, dummy);
Expand Down
12 changes: 5 additions & 7 deletions tensorflow/lite/kernels/test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,7 @@ void SingleOpModel::BuildInterpreter(std::vector<std::vector<int>> input_shapes,
int num_threads,
bool allow_fp32_relax_to_fp16,
bool apply_delegate,
bool allocate_and_delegate,
bool use_simple_allocator) {
bool allocate_and_delegate) {
input_shapes_ = input_shapes;
allow_fp32_relax_to_fp16_ = allow_fp32_relax_to_fp16;
apply_delegate_ = apply_delegate;
Expand All @@ -465,7 +464,7 @@ void SingleOpModel::BuildInterpreter(std::vector<std::vector<int>> input_shapes,
uint8_t* buffer_pointer = builder_.GetBufferPointer();
UpdateOpVersion(buffer_pointer);

use_simple_allocator |=
bool use_simple_allocator =
tflite::KernelTestDelegateProviders::Get()->ConstParams().Get<bool>(
tflite::KernelTestDelegateProviders::kUseSimpleAllocator);

Expand Down Expand Up @@ -553,12 +552,11 @@ TfLiteStatus SingleOpModel::ApplyDelegate() {

TfLiteStatus SingleOpModel::Invoke() { return interpreter_->Invoke(); }

void SingleOpModel::BuildInterpreter(std::vector<std::vector<int>> input_shapes,
bool use_simple_allocator) {
void SingleOpModel::BuildInterpreter(
std::vector<std::vector<int>> input_shapes) {
BuildInterpreter(input_shapes, /*num_threads=*/-1,
/*allow_fp32_relax_to_fp16=*/false,
/*apply_delegate=*/true, /*allocate_and_delegate=*/true,
use_simple_allocator);
/*apply_delegate=*/true, /*allocate_and_delegate=*/true);
}

// static
Expand Down
6 changes: 2 additions & 4 deletions tensorflow/lite/kernels/test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -847,11 +847,9 @@ class SingleOpModel {
// `apply_delegate` is ignored.
void BuildInterpreter(std::vector<std::vector<int>> input_shapes,
int num_threads, bool allow_fp32_relax_to_fp16,
bool apply_delegate, bool allocate_and_delegate = true,
bool use_simple_allocator = false);
bool apply_delegate, bool allocate_and_delegate = true);

void BuildInterpreter(std::vector<std::vector<int>> input_shapes,
bool use_simple_allocator = false);
void BuildInterpreter(std::vector<std::vector<int>> input_shapes);

TfLiteStatus AllocateTensors();

Expand Down
Loading
0