TrainingExtensions/tensorflow/src/python/aimet_tensorflow/keras/utils/common.py
def _link_following_layers_to_new_layer_output(new_tensor_output: tf.Tensor,
                                               following_layers_and_inputs_dict: typing.Dict[tf.keras.layers.Layer,
                                                                                             typing.List[tf.Tensor]],
                                               replaced_layer: tf.keras.layers.Layer):
    """
    Link following layers to the given tensor.
    :param new_tensor_output: Tensor to link to following layers
    :param following_layers_and_inputs_dict: Dictionary containing following layers to link new tensor to
    :param replaced_layer: Layer that was replaced
    """
    # pylint: disable=protected-access
    for following_layer, keras_inputs in following_layers_and_inputs_dict.items():
        for idx, keras_input in enumerate(keras_inputs):
            if keras_input._keras_history.layer == replaced_layer:
                keras_inputs[idx] = new_tensor_output
        # Flatten list if only one input
        if isinstance(keras_inputs, list):
            keras_inputs = keras_inputs[0]
        _ = following_layer(keras_inputs)

    Link following layers to the given tensor.
    :param new_tensor_output: Tensor to link to following layers
    :param following_layers_and_inputs_dict: Dictionary containing following layers to link new tensor to
    :param replaced_layer: Layer that was replaced
    
Link following layers to the given tensor.
Link following layers to the given tensor .
def _link_following_layers_to_new_layer_output(new_tensor_output: tf.Tensor,
                                               following_layers_and_inputs_dict: typing.Dict[tf.keras.layers.Layer,
                                                                                             typing.List[tf.Tensor]],
                                               replaced_layer: tf.keras.layers.Layer):
    for following_layer, keras_inputs in following_layers_and_inputs_dict.items():
        for idx, keras_input in enumerate(keras_inputs):
            if keras_input._keras_history.layer == replaced_layer:
                keras_inputs[idx] = new_tensor_output
        if isinstance(keras_inputs, list):
            keras_inputs = keras_inputs[0]
        _ = following_layer(keras_inputs)
def _link_following_layers_to_new_layer_output ( new_tensor_output : tf . Tensor , following_layers_and_inputs_dict : typing . Dict [ tf . keras . layers . Layer , typing . List [ tf . Tensor ] ] , replaced_layer : tf . keras . layers . Layer ) : for following_layer , keras_inputs in following_layers_and_inputs_dict . items ( ) : for idx , keras_input in enumerate ( keras_inputs ) : if keras_input . _keras_history . layer == replaced_layer : keras_inputs [ idx ] = new_tensor_output if isinstance ( keras_inputs , list ) : keras_inputs = keras_inputs [ 0 ] _ = following_layer ( keras_inputs )
Link following layers to the given tensor.
Link following layers to the given tensor .
"""
    Link following layers to the given tensor.
    :param new_tensor_output: Tensor to link to following layers
    :param following_layers_and_inputs_dict: Dictionary containing following layers to link new tensor to
    :param replaced_layer: Layer that was replaced
    """ # pylint: disable=protected-access # Flatten list if only one input
new_tensor_output
tf.Tensor
Tensor to link to following layers
Tensor to link to following layers
following_layers_and_inputs_dict
typing.Dict[tf.keras.layers.Layer,
                                                                                             typing.List[tf.Tensor]]
Dictionary containing following layers to link new tensor to
Dictionary containing following layers to link new tensor to
replaced_layer
tf.keras.layers.Layer
Layer that was replaced
Layer that was replaced