addons icon indicating copy to clipboard operation
addons copied to clipboard

ValueError: Dimensions must be equal, but are 75 and 8 for

Open paktiger opened this issue 3 years ago • 0 comments

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • TensorFlow version and how it was installed (source or binary): Version: 2.7.0
  • TensorFlow-Addons version and how it was installed (source or binary): 0.15.0
  • Python version: 3.8
  • Is GPU used? (yes/no): no

Describe the bug I am using a text dataset on BiLSTM-CRF and I am using Keras for BiLSTM and TensorFlow-addons for CRF layer but When I train the BiLSTM-CRF model it generates the following error: ValueError: Dimensions must be equal, but are 75 and 8 for '{{node mean_absolute_error/sub}} = Sub[T=DT_INT32](model_1/crf_1/ReverseSequence_1, mean_absolute_error/Cast)' with input shapes: [?,75], [?,75,8].

A clear and concise description of what the bug is. model.compile('rmsprop', loss='mean_absolute_error', metrics=['accuracy']) history = model.fit(X_tr, np.array(y_tr), batch_size=22, epochs=20, validation_split=0.1, verbose=1) The following is the model summary

`Model: "model_1"


Layer (type) Output Shape Param #

input_2 (InputLayer) [(None, 75)] 0

embedding_1 (Embedding) (None, 75, 20) 259240

bidirectional_1 (Bidirectio (None, 75, 150) 57600
nal)

time_distributed_1 (TimeDis (None, 75, 75) 11325
tributed)

crf_1 (CRF) [(None, 75), 688
(None, 75, 8),
(None,),
(8, 8)]

================================================================= Total params: 328,853 Trainable params: 328,853 Non-trainable params: 0 _________________________________________________________________` Code to reproduce the issue

Provide a reproducible test case that is the bare minimum necessary to generate the problem.

Other info / logs

Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

paktiger avatar Dec 15 '21 16:12 paktiger