Skip to content

Commit

Permalink
Model files have new parts
Browse files Browse the repository at this point in the history
  • Loading branch information
lim185 committed Sep 30, 2025
1 parent 2863d8b commit 4f59193
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions model/dnn.py
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
#-- coding: utf-8 -*-

# This code defines a simple Deep Neural Network (DNN) model using Keras.

import keras

class DNN(keras.Model):
def __init__(self, input_shape, layer_stack_size, num_classes):
super(DNN, self).__init__()
self.input_layer = keras.layers.InputLayer(input_shape=input_shape)
for i in range(layer_stack_size):
setattr(self, f"hidden_layer{i+1}",
keras.layers.Dense(input_shape, activation="relu"))
self.output_layer = keras.layers.Dense(num_classes, activation="softmax")

def call(self, inputs):
x = self.input_layer(inputs)
x = self.hidden_layer1(x)
x = self.hidden_layer2(x)
return self.output_layer(x)
1 change: 1 addition & 0 deletions model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def _transformerblocks(self, inputs, head_size, num_heads,
Returns:
A model layer.
"""
inputs = Masking(mask_value=pad_value)(inputs)
x = MultiHeadAttention(
key_dim=head_size, num_heads=num_heads,
dropout=dropout)(inputs, inputs)
Expand Down

0 comments on commit 4f59193

Please sign in to comment.