diff --git a/tensorflow/lite/delegates/gpu/gl/compiler/variable_accessor.cc b/tensorflow/lite/delegates/gpu/gl/compiler/variable_accessor.cc index e4dc75eef6e..9bac6d62a62 100644 --- a/tensorflow/lite/delegates/gpu/gl/compiler/variable_accessor.cc +++ b/tensorflow/lite/delegates/gpu/gl/compiler/variable_accessor.cc @@ -371,10 +371,16 @@ std::string VariableAccessor::GetConstDeclarations() const { // with index. std::string declarations; for (const auto& variable : name_to_variable_) { + // Skip shared variables. + const std::string& variable_name = variable.second.name; + if (shared_variables_.find(variable_name) != shared_variables_.end()) { + continue; + } + const auto& value = variable.second.value; if (IsVariableLength(value)) { absl::StrAppend(&declarations, "const ", GetVariableType(value), " ", - variable.second.name, "[] = "); + variable_name, "[] = "); GetValue(value, &declarations); absl::StrAppend(&declarations, ";\n"); }