<jupyter_start><jupyter_text>https://www.tensorflow.org/versions/r2.0/api_docs/python/tfhttps://keras.io/<jupyter_code>import tensorflow as tf

from tensorflow import keras
import numpy as np
from tensorflow.keras import layers
from tensorflow.keras.constraints import max_norm

data = np.random.random((1000, 32))
labels = np.random.random((1000, 10))

val_data = np.random.random((100, 32))
val_labels = np.random.random((100, 10))
model = tf.keras.Sequential([
    
    layers.Dense(64, activation='relu', input_shape=(32,)),

    layers.Dense(64, activation='relu'),

    layers.Dense(10)])

model.compile(optimizer=tf.keras.optimizers.Adam(0.01),
              loss=tf.keras.losses.CategoricalCrossentropy(from_logits=True),
              metrics=['accuracy'])

model.fit(data, labels, epochs=10, batch_size=32,
          validation_data=(val_data, val_labels))
model = tf.keras.Sequential()

model.add(layers.Dense(64, activation='relu', input_shape=(32,)))
model.add(layers.Dense(64, activation='relu'))
model.add(layers.Dense(10))

model.compile(optimizer=tf.keras.optimizers.Adam(0.01),
              loss=tf.keras.losses.CategoricalCrossentropy(),
              metrics=['accuracy'])

model.fit(data, labels, epochs=10, batch_size=32,
          validation_data=(val_data, val_labels))
inputs = tf.keras.Input(shape=(32,))

x = layers.Dense(64, activation='relu')(inputs)
x = layers.Dense(64, activation='relu')(x)

predictions = layers.Dense(10)(x)


model = tf.keras.Model(inputs=inputs, outputs=predictions)

model.compile(optimizer=tf.keras.optimizers.Adam(0.01),
              loss=tf.keras.losses.CategoricalCrossentropy(from_logits=True),
              metrics=['accuracy'])

model.fit(data, labels, epochs=10, batch_size=32,
          validation_data=(val_data, val_labels))
layers.Dense(units=64, activation=('relu'), 
    use_bias=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', 
    kernel_regularizer=regularizers.l2(0.01), activity_regularizer=regularizers.l1(0.01),
    bias_regularizer=l1_l2(l1=0.01, l2=0.01), kernel_constraint=max_norm(2.), bias_constraint=None)
layers.Conv2D(filters=32, kernel_size=5, strides=(1, 1), padding='valid', data_format='channels_last', dilation_rate=(1, 1), 
    activation="relu", 
    use_bias=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', kernel_regularizer=None, 
    bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, bias_constraint=None)
layers.MaxPooling2D(pool_size=(2, 2), strides=None, padding='valid', data_format='channels_last')

layers.LSTM(units=64, activation='tanh', recurrent_activation='sigmoid', use_bias=True, 
                  kernel_initializer='glorot_uniform', recurrent_initializer='orthogonal', bias_initializer='zeros', 
                  unit_forget_bias=True, kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, 
                  activity_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, 
                  dropout=0.0, recurrent_dropout=0.0, implementation=2, return_sequences=False, return_state=False, 
                  go_backwards=False, stateful=False, unroll=False)

layers.BatchNormalization(axis=-1, momentum=0.99, epsilon=0.001, center=True, scale=True, beta_initializer='zeros', 
                                gamma_initializer='ones', moving_mean_initializer='zeros', moving_variance_initializer='ones', 
                                beta_regularizer=None, gamma_regularizer=None, beta_constraint=None, gamma_constraint=None)

inputs = tf.keras.Input(shape=(32,))

x = layers.Dense(64, activation='relu')(inputs)
x = layers.Dense(64, activation='relu')(x)

output1 = layers.Dense(64, activation='relu')(x)
output2 = layers.Dense(64, activation='relu')(x)

added = keras.layers.Add()([output1, output2])
subtracted = keras.layers.Subtract()([output1, output2])

multiply = keras.layers.Multiply()([output1, output2])
concatenate = keras.layers.Concatenate()([output1, output2])
average = keras.layers.Average()([output1, output2])

predictions = layers.Dense(10)(added)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1445142580956984, 'fraction_numerical': 0.033832769453842435, 'mean_word_length': 5.2617246596066565, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '620668', 'license': 'MIT', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1374, 'n_words': 188, 'path': 'Example Notebooks/Keras and Tensorflow.ipynb', 'repo_name': 'gitter-badger/introduction-to-modern-data-science', 'size': '4138'}