code: def update_symbolic_weights(
      layer: Layer, weight_mapping: dict[str, Tensor]
  ) -> None:
      """Updates the symbolic tensors of a layer
  
      Updates the symbolic tensors of a layer by replacing them.
  
      Note this does not update the loss or anything alike!
      Use with caution!
  
      :param layer: Targeted layer.
      :param weight_mapping: Dict with attribute name and weight tensors
        as keys and values.
      """
  
      trainable_weight_ids = [id(x) for x in layer._trainable_weights]
      non_trainable_weight_ids = [
          id(x) for x in layer._non_trainable_weights
      ]
  
      for name, weight in weight_mapping.items():
          current_weight = getattr(layer, name)
          current_weight_id = id(current_weight)
  
          if current_weight_id in trainable_weight_ids:
              idx = trainable_weight_ids.index(current_weight_id)
              layer._trainable_weights[idx] = weight
          else:
              idx = non_trainable_weight_ids.index(current_weight_id)
              layer._non_trainable_weights[idx] = weight
  
          setattr(layer, name, weight)
  
imports: from __future__ import annotations
  import inspect
  import warnings
  from abc import ABCMeta, abstractmethod
  from typing import Any, Callable
  import numpy
  import tensorflow.keras.backend
  import tensorflow.keras.layers
  import tensorflow.keras.models
  import innvestigate.backend
  import innvestigate.backend.checks
  import innvestigate.layers
  from innvestigate.backend.types import Layer, LayerCheck, Model, NodeDict, OptionalList, ReverseTensorDict, Tensor
label_desc: Use image node_id 5 for calling a global function with example usage: update_symbolic_weights(layer, weight_mapping) without return types