tensorflow/lite/delegates/gpu/common/gpu_model.cc
// Removing tensors that was fused in complex operations
Removing tensors that was fused in complex operations
Removing tensors that was fused in complex operations
void RemoveUnusedTensors(GpuModel* gpu_model) {
  absl::flat_hash_set<ValueId> used_tensors;
  for (const auto& node : gpu_model->nodes) {
    for (const auto& id : node.inputs) {
      used_tensors.insert(id);
    }
    for (const auto& id : node.outputs) {
      used_tensors.insert(id);
    }
  }
  for (auto it = gpu_model->tensors.begin(); it != gpu_model->tensors.end();) {
    if (used_tensors.find(it->first) == used_tensors.end()) {
      gpu_model->tensors.erase(it++);
    } else {
      ++it;
    }
  }
}
void RemoveUnusedTensors ( GpuModel * gpu_model ) { absl :: flat_hash_set < ValueId > used_tensors ; for ( const auto & node : gpu_model -> nodes ) { for ( const auto & id : node . inputs ) { used_tensors . insert ( id ) ; } for ( const auto & id : node . outputs ) { used_tensors . insert ( id ) ; } } for ( auto it = gpu_model -> tensors . begin ( ) ; it != gpu_model -> tensors . end ( ) ; ) { if ( used_tensors . find ( it -> first ) == used_tensors . end ( ) ) { gpu_model -> tensors . erase ( it ++ ) ; } else { ++ it ; } } }
Removing tensors that was fused in complex operations
Removing tensors that was fused in complex operations