I'm very new to this so please feel free to patronise me and dumb it down. Also I'm using google collab and have had a handful of tensorflow and keras errors along the way.

ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type list).

This error only appeared when trying to compile the NN layers.

```
!pip install tensorflow
import numpy as np
from matplotlib import pyplot as plt
import tensorflow as tf
import pandas as pd
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import concatenate
from tensorflow.keras.layers import Flatten
from tensorflow.keras.layers import add
from tensorflow.keras.utils import to_categorical
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.reuters.load_data(
path="reuters.npz",
num_words=None,
skip_top=0,
maxlen=None,
test_split=0.2,
seed=113,
start_char=1,
oov_char=2,
index_from=3
)
widx = tf.keras.datasets.reuters.get_word_index(path="reuters_word_index.json")
print(widx)
def vectorize_sequences(sequences, dimension=1000):
results = np.zeros((len(sequences), dimension))
for i, sequences in enumerate(sequences):
s = [i for i in sequences if i < dimension]
results[i, s] = 1
return results
X_test = vectorize_sequences(x_test)
X_train = vectorize_sequences(x_train)
#one-hot encoding
Y_test = pd.get_dummies(y_test)
Y_train = pd.get_dummies(y_train)
print(X_test)
x0 = tf.keras.Input(shape=X_train.shape[1:], name="Input")
x11 = Dense(100, activation="relu")(x0) # layer 1,1
x12 = Dense(100, activation="relu")(x11) # layer 1,2
x21 = Dense(100, activation = 'relu')(x0) # layer 2,1
x22 = Dense(100, activation = 'relu')(x21) # layer 2,2
concat = concatenate([x12, x22])
x3 = Dense(100, activation='sigmoid')(concat)
model = tf.keras.Model(inputs=x0, outputs=x3)
model.summary
tf.keras.utils.plot_model(model, "Q2_plot.png", show_shapes=True)
model.compile(loss='binary_crossentropy',optimizer='adam',metrics=['accuracy'])
history = model.fit(x_train, y_train, validation_data = (x_test,y_test),epochs=20, batch_size=64)
model.summary()
```