text_plain_output_1.png
import numpy as np

import tensorflow as tf

training_inputs = np.array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype=np.float32)
training_outputs = np.array([[0], [1], [1], [1]], dtype=np.float32)

i = tf.keras.Input(2)
x = tf.keras.layers.Dense(8, activation='relu')(i)
x = tf.keras.layers.Dense(16, activation='relu')(x)
x = tf.keras.layers.Dense(32, activation='tanh')(x)
x = tf.keras.layers.Dense(8, activation='tanh')(x)
x = tf.keras.layers.Dense(1, activation='sigmoid')(x)
model = tf.keras.models.Model(i, x)

model.summary()

model.compile(loss='mean_squared_error', optimizer='adam', metrics='accuracy')

r = model.fit(training_inputs, training_outputs, epochs=100)