i have multi dim input

# энкодер трансформера с регуляризацией и батч-нормализацией
def gru_branch(inputs, units, dropout, l2_reg=0.01):
    x = layers.LayerNormalization(epsilon=1e-6)(inputs)
    x = layers.GRU(units, activation='tanh', return_sequences=True, kernel_regularizer=regularizers.l2(l2_reg))(x)
    x = layers.Dropout(dropout)(x)
    x = layers.Dense(128, activation='relu', kernel_regularizer=regularizers.l2(l2_reg))(x)
    return x + inputs

def transformer_encoder(inputs, head_size, num_heads, ff_dim, dropout=0):
    # Normalization and Attention
    x = layers.LayerNormalization(epsilon=1e-6)(inputs)
    x = layers.MultiHeadAttention(
        key_dim=head_size, num_heads=num_heads, dropout=dropout
    )(x, x)
    x = layers.Dropout(dropout)(x)
    res = x + inputs

    # Feed Forward Part
    x = layers.LayerNormalization(epsilon=1e-6)(res)
    x = layers.Conv1D(filters=ff_dim, kernel_size=1, activation="relu")(x)
    x = layers.Dropout(dropout)(x)
    x = layers.Conv1D(filters=inputs.shape[-1], kernel_size=1)(x)
    return x + res

and i have an error
ValueError                                Traceback (most recent call last)
Cell In[38], line 8
      5 num_epochs = 100
      6 input_shape = X_.shape[1:]
----> 8 model = build_model(
      9     input_shape,
     10     head_size=256,
     11     num_heads=4,
     12     ff_dim=4,
     13     num_transformer_blocks=4,
     14     mlp_units=[128],
     15     gru_units=128,
     16     l2_reg=0.01,
     17     mlp_dropout=0.4,
     18     dropout=0.25
     19 )
     21 model.compile(
     22     loss="mean_squared_error",
     23     optimizer=keras.optimizers.Adam(learning_rate=1e-4)
     24 )
     25 # model.summary()

Cell In[26], line 20, in build_model(input_shape, head_size, num_heads, ff_dim, num_transformer_blocks, mlp_units, gru_units, l2_reg, dropout, mlp_dropout)
     17 for _ in range(num_transformer_blocks):
     18     x = transformer_encoder(x, head_size, num_heads, ff_dim, dropout)
---> 20 y = gru_branch(y, gru_units, dropout, l2_reg) #new
     22 x = layers.Concatenate()([x, y]) #new
     24 x = layers.GlobalAveragePooling1D(data_format="channels_first")(x)

Cell In[37], line 7, in gru_branch(inputs, units, dropout, l2_reg)
      5 x = layers.Dropout(dropout)(x)
      6 x = layers.Dense(128, activation='relu', kernel_regularizer=regularizers.l2(l2_reg))(x)
----> 7 return x + inputs

File ~\miniconda3\envs\pronin\lib\site-packages\tensorflow\python\util\traceback_utils.py:153, in filter_traceback.<locals>.error_handler(*args, **kwargs)
    151 except Exception as e:
    152   filtered_tb = _process_traceback_frames(e.__traceback__)
--> 153   raise e.with_traceback(filtered_tb) from None
    154 finally:
    155   del filtered_tb

File ~\miniconda3\envs\pronin\lib\site-packages\keras\layers\core\tf_op_layer.py:119, in KerasOpDispatcher.handle(self, op, args, kwargs)
    114 """Handle the specified operation with the specified arguments."""
    115 if any(
    116     isinstance(x, keras_tensor.KerasTensor)
    117     for x in tf.nest.flatten([args, kwargs])
    118 ):
--> 119     return TFOpLambda(op)(*args, **kwargs)
    120 else:
    121     return self.NOT_SUPPORTED

File ~\miniconda3\envs\pronin\lib\site-packages\keras\utils\traceback_utils.py:70, in filter_traceback.<locals>.error_handler(*args, **kwargs)
     67     filtered_tb = _process_traceback_frames(e.__traceback__)
     68     # To get the full stack trace, call:
     69     # `tf.debugging.disable_traceback_filtering()`
---> 70     raise e.with_traceback(filtered_tb) from None
     71 finally:
     72     del filtered_tb

ValueError: Exception encountered when calling layer "tf.__operators__.add_85" (type TFOpLambda).

Dimensions must be equal, but are 128 and 5 for '{{node tf.__operators__.add_85/AddV2}} = AddV2[T=DT_FLOAT](Placeholder, Placeholder_1)' with input shapes: [?,128,128], [?,128,5].

Call arguments received by layer "tf.__operators__.add_85" (type TFOpLambda):
  • x=tf.Tensor(shape=(None, 128, 128), dtype=float32)
  • y=tf.Tensor(shape=(None, 128, 5), dtype=float32)
  • name=None

how to solve?